Accepted Java - hlog(h)+wlog(w), O(1) (beats 100%)
\n\nThe trick is to find the biggest delta cut horizontally and biggest delta cut vertically and multiply them! \n\nSolution: maxHorizontalDelta*maxVerticalDelt
\n\nThe trick is to find the biggest delta cut horizontally and biggest delta cut vertically and multiply them! \n\nSolution: maxHorizontalDelta*maxVerticalDelta \n\nTime complexity : hlog(h)+wlog(w)\nSpace complexity : O(1)\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 modulo = 1000000007;\n        long maxHorizontalDelta = horizontalCuts[0];\n        long maxVerticalDelta = verticalCuts[0];\n        for(int i=1;i<horizontalCuts.length;i++){\n            if(horizontalCuts[i]-horizontalCuts[i-1]>maxHorizontalDelta){\n                maxHorizontalDelta = horizontalCuts[i]-horizontalCuts[i-1];\n            }\n        }\n        if(h-horizontalCuts[horizontalCuts.length-1]>maxHorizontalDelta){\n            maxHorizontalDelta = h-horizontalCuts[horizontalCuts.length-1];\n        }\n        for(int i=1;i<verticalCuts.length;i++){\n            if(verticalCuts[i]-verticalCuts[i-1]>maxVerticalDelta){\n                maxVerticalDelta = verticalCuts[i]-verticalCuts[i-1];\n            }\n        }\n        if(w-verticalCuts[verticalCuts.length-1]>maxVerticalDelta){\n                maxVerticalDelta = w-verticalCuts[verticalCuts.length-1];\n        }\n        return (int) (maxHorizontalDelta*maxVerticalDelta % modulo);\n    }\n}\n```
[]