Sort  And take care of first and the last cut of  Horizontal as well as Vertical cuts
\nclass Solution {\n\tpublic int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {\n\t\tArrays.sort(horizontalCuts);\n\t\tArrays.sort(verticalCu
```\nclass Solution {\n\tpublic int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {\n\t\tArrays.sort(horizontalCuts);\n\t\tArrays.sort(verticalCuts);\n\n\t\tint maxH = Math.max(horizontalCuts[0] - 0, h - horizontalCuts[horizontalCuts.length - 1]);\n\t\tint maxW = Math.max(verticalCuts[0] - 0, w - verticalCuts[verticalCuts.length - 1]);\n\n\t\tfor (int i = 1; i < horizontalCuts.length; i++) {\n\t\t\tmaxH = Math.max(maxH, horizontalCuts[i] - horizontalCuts[i - 1]);\n\t\t}\n\n\t\tfor (int i = 1; i < verticalCuts.length; i++) {\n\t\t\tmaxW = Math.max(maxW, verticalCuts[i] - verticalCuts[i - 1]);\n\t\t}\n\n\t\treturn (int) (((long)maxH * (long)maxW) % 1000000007);\n\t}\n}\n\n```
['Java']