[Python] Explained , Sorting, Greedy approach
Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts\n\nIdea\nIn the problem statement it is asked the maximum rectangle after Horizontal Cut and 
# Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts\n\n**Idea**\nIn the problem statement it is asked the maximum rectangle after Horizontal Cut and Vertical Cut \n\nFor eg:- dimensions `9, 9` **Horizontal Cuts** - `[7, 1, 2]`, similarly for vertical cuts. \n\n* So it is obvious that after cut , there is no other cut in the rectangle piece of cake - the cut `7` & `1` have differece\xA0`6` but there is another cut `2` is `1<2<7` \xA0so we use **greedy approach** and arrange it to give `[1, 2, 7]` , Now differences of\xA0`0-1, 1-2, 2-7, 7-9` is `1, 1, 5, 2` maximum \xA0horizontal & vertical difference are **maxh** = `5` & **maxh** = `5` respectively.\n* and it is given both horizontal and vertical cuts are the distance from top i.e. 0 , both are within `(0, h) i.e (0, 9)` and `(0, w) i.e. (0, 9)`\n\nThat\'s why these cuts do not have other cuts b/w they must be arranged in order (ascending/descending)\nThus, the result can be get by **the product of the maximum diffrence of horizontal cut and maximum difference of vertical cuts** i.e. **maxh`*`maxv**(5`*`5) = `25`\n\n**Complexity**\n* `Time Complexity` -> `O(nlog(n)+ mlog(m))`\n* `Space Complexity` -> `O(1)` \n\n\n*please upvote if you like the solution and comment if have queries*\n```\nclass Solution:\n    def maxArea(self, h: int, w: int, horizontalCuts: List[int], verticalCuts: List[int]) -> int:\n        m, n = len(horizontalCuts), len(verticalCuts)\n        #For horizontal cuts\n        horizontalCuts.sort()\n \xA0 \xA0 \xA0 \xA0maxh = max(horizontalCuts[0],h-horizontalCuts[-1])#max of starting and endind cake piece\n \xA0 \xA0 \xA0 \xA0for i in range(1, m):\n            maxh = max(maxh, horizontalCuts[i]-horizontalCuts[i-1])\n        \n        #For vertical cuts\n \xA0 \xA0 \xA0 \xA0verticalCuts.sort()\n\t\tmaxv = max(verticalCuts[0], w-verticalCuts[-1])#max of starting and ending cake piece\n \xA0 \xA0 \xA0 \xA0for i in range(1, n):\n \xA0 \xA0 \xA0 \xA0 \xA0 \xA0maxv = max(maxv, verticalCuts[i]-verticalCuts[i-1])\n        return (maxh*maxv)%(int(1e9)+7)\n```
['Greedy', 'Sorting', 'Python']