Java solution || 16ms ||98 % better
Approach:\nsort both horizontal as well as verticalcuts arrays\ncompute the maxx and maxy for finding  which pair of horizontal and vertical cut gives us maximu
Approach:\nsort both horizontal as well as verticalcuts arrays\ncompute the maxx and maxy for finding  which pair of horizontal and vertical cut gives us maximum area\nreturn maxX* maxY for returning area \n\nNote:\nkeep constraints in mind before submitting a silution\n\n\n\n\n```\nclass Solution {\n    public int maxArea(int h, int w, int[] x, int[] y) {\n        Arrays.sort(x);\n        Arrays.sort(y);\n        int maxX = x[0], maxY = y[0];\n        for (int i = 1; i < x.length; i++) {\n            maxX = Math.max(maxX, x[i] - x[i - 1]);\n        }\n        maxX = Math.max(maxX, h - x[x.length - 1]);\n        for (int i = 1; i < y.length; i++) {\n            maxY = Math.max(maxY, y[i] - y[i - 1]);\n        }\n        maxY = Math.max(maxY, w - y[y.length - 1]);\n        return (int) ((long) maxX * (long)maxY % 1000000007L);\n    }\n}\n```\n\n\n\n![image](https://assets.leetcode.com/users/images/ec8dd4bb-d875-4f3d-97fe-1d3a7544df8f_1656740731.9751992.jpeg)\n
['Sorting', 'Java']