You are given an array of integers `arr` of length `n`. Find the maximum number of pairs that can be formed such that the index of the first element is greater than the index of the second element and the value of the first element is less than the value of the second element.
Explanation: All possible pairs are (1,0), (2,0), (2,1), (3,0), (3,1), (3,2) with index of first element greater than index of second element.
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak