Easy to Understand Java Solution, Explanation with Comments with Sort/Math
\nclass Solution {\n    \n    public int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {\n        \n        /* Idea is to maximize the height 
```\nclass Solution {\n    \n    public int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {\n        \n        /* Idea is to maximize the height and width for maximizing area of Rectange \n           We have to sort both the arrays.\n           \n           -> Find max diff between hor[i] - hor[i-1] for max width\n           -> Find max diff between ver[i] - ver[i-1] for max height\n           -> Multiply maxWidth * maxHeight => maxArea\n        \n           Example: hor = [2, 4, 7]  ver = [3, 5, 8] \n                    Consider corner case also:\n                    i. Corners  => [0, 2, 4, 7, h]   [0, 3, 5, 8, w]\n           \n                    Sometimes, it may be possible that the corners (which itselfs are cuts)\n                    also can have larger area:\n                    \n                    eg: [0, 12, 14, 17, h] \n                        => { 12-0 or h-17 } can be more than { 14-12 or 17-14 }\n        */\n        \n        // Sort the arrays for finding max differences\n        \n        Arrays.sort(horizontalCuts);\n        Arrays.sort(verticalCuts);\n        \n        int m = horizontalCuts.length;\n        int n = verticalCuts.length;\n\n        // Calculate max diff for corner case : (arr[0] - 0), (total h/w - arr[n-1]) \n        \n        long horMax = Math.max(horizontalCuts[0], h - horizontalCuts[m - 1]);\n        long verMax = Math.max(verticalCuts[0], w - verticalCuts[n - 1]);\n        \n        // Compare corner case differences with alternate coordinates, update max.\n        \n        for (int i = 1; i < m; i++) {\n            horMax = Math.max(horMax, horizontalCuts[i] - horizontalCuts[i - 1]);\n        }\n        \n        for (int i = 1; i < n; i++) {\n            verMax = Math.max(verMax, verticalCuts[i] - verticalCuts[i - 1]);\n        }\n        \n        // Return answer module mod.\n        \n        //double mod = 1000000007;\n        //return (int) ((horMax * verMax) % mod);\n        return (int) ((horMax * verMax) % (Math.pow(10, 9) + 7));\n                \n    }\n}\n```\n\n\n**Please Upvote if you find it helpful. Happy Coding!**
['Sorting', 'Java']