Easy Java Implementation with Explanation
Approach:\n Sort the 2 arrays\n Find the max difference between adjacent values in both the arrays\n Multiple horizontalMax and verticalMax for area\n Return th
Approach:\n* Sort the 2 arrays\n* Find the max difference between adjacent values in both the arrays\n* Multiple horizontalMax and verticalMax for area\n* Return the area\n\n```\nclass Solution {\n    public int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {\n        Arrays.sort(horizontalCuts);\n        Arrays.sort(verticalCuts);\n        int hl = horizontalCuts.length;\n        int vl = verticalCuts.length;\n        \n        int hMax = Math.max(horizontalCuts[0]-0, h-horizontalCuts[hl-1]);\n        int vMax = Math.max(verticalCuts[0]-0, w-verticalCuts[vl-1]);\n        \n        hMax=max(horizontalCuts,hMax);\n        vMax=max(verticalCuts,vMax);\n        \n        int mod = 1000000007;\n        int area = (int)(((long)hMax*(long)vMax)%mod);\n        return area;\n    }\n    \n    public int max(int[] arr, int tempMax){\n        \n        for(int i=0;i<arr.length-1;i++){\n            int diff = arr[i+1] - arr[i];\n            if(diff > tempMax) tempMax = diff;\n        }     \n        return tempMax;\n    }\n}\n```
['Java']