Easy java solution - Question and Answer explained in details
The problem is to find the maximum area of a sub-rectangle.\nArea = length\breadth\nSo, in order to maximize the area, we need to maximize the length and the br
The problem is to find the maximum area of a sub-rectangle.\nArea = length\\*breadth\nSo, in order to maximize the area, we need to maximize the length and the breadth. To achieve this, first we need to find lengths and breadths of all sub-rectangles and then among them we need to find the maximum length and maximum breadth. Remeber that, we must sort the cuts arrays so that we can get continous cuts from left to right, otherwise it will be very hard to find continous cuts. Once maximum of length and breadth is found, multiply these two to get the area which eventually will be the maximum area.\n\nNote - since numbers can be very large, use the long or long long data type to store values otherwise there will be overflow.\n\nPlease upvote if you like the solution.\n\n```\npublic int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {\n        Arrays.sort(horizontalCuts);\n        Arrays.sort(verticalCuts);\n        long maxHdiff = 0;\n        long maxVdiff = 0;\n        int i;\n        int back = 0;\n        for(i = 0;i<horizontalCuts.length;i++){\n            maxHdiff = Math.max(maxHdiff, horizontalCuts[i]-back);\n            back = horizontalCuts[i];\n        }\n        maxHdiff = Math.max(maxHdiff, h-back);\n        back = 0;\n        for(i = 0;i<verticalCuts.length;i++){\n            maxVdiff = Math.max(maxVdiff, verticalCuts[i]-back);\n            back = verticalCuts[i];\n        }\n        maxVdiff = Math.max(maxVdiff, w-back);\n        return (int)((maxHdiff % 1000000007)*(maxVdiff % 1000000007)% 1000000007);\n    }\n\t
['Sorting', 'Java']