Java | fastest | simple solution
We don\'t actually need to reconstruct the whole array to represent cake, we just need to find the largest gap between 2 cuts (including start and end bounderie
We don\'t actually need to reconstruct the whole array to represent cake, we just need to **find the largest gap between 2 cuts** (including start and end bounderies as cuts) **both horizontally and vertically**, and **return their product**.\n```\nprivate long getMaxDiff(int[] arr, int ei) {\n\tArrays.sort(arr);\n\tint len = 0, st = 0;\n\tfor (int i : arr) {\n\t\tlen = Math.max(i - st, len);\n\t\tst = i;\n\t}\n\tlen = Math.max(len, ei - st);\n\treturn len;\n}\npublic int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {\n\tlong hl = getMaxDiff(horizontalCuts, h);\n\tlong vl = getMaxDiff(verticalCuts, w);\n\treturn (int)((hl * vl) % 1000000007);\n}\n```
['Java']