I understood the editorial to the question but why does my approach not work?
My approach-
Sort the lengths and breadth in two different lists and maintain pointers to the first element of each of them. Let’s call these two lists l and b, and the two pointers i and j for our convenience.
Let A1 = l[i] * b[j+1] and A2 = l[i+1] * b[j]
(i.e. A1 = smallest length * second smallest breadth; A2 = second smallest length * smallest breadth)
If A1 < A2 remove the rectangle with shortest length and mark it as removed else remove rectangle with shortest breadth and mark that as removed.
My code
Any help will be appreciated!