JS solution without overflow error
Most JS solutions will not work correctly on this test case\n\nInput: h = 10^9, w = 10^9, horizontalCuts = [1], verticalCuts = [1]\nOutput: 64\n\n\nSo, you need
Most JS solutions will not work correctly on this test case\n```\nInput: h = 10^9, w = 10^9, horizontalCuts = [1], verticalCuts = [1]\nOutput: 64\n```\n\nSo, you need check overflow before returning answer. Correctly code would look like this:\n```\nvar maxArea = function (h, w, horizontalCuts, verticalCuts) {\n    horizontalCuts = horizontalCuts.sort((a, b) => a - b);\n    verticalCuts = verticalCuts.sort((a, b) => a - b);\n    \n    let maxRow = horizontalCuts[0];\n    for(let i = 1; i < horizontalCuts.length; i++){\n        maxRow = Math.max(maxRow, horizontalCuts[i] - horizontalCuts[i - 1])\n    }\n    maxRow = Math.max(maxRow, h - horizontalCuts[horizontalCuts.length - 1])\n\n    let maxCol = verticalCuts[0];\n    for(let i = 1; i < verticalCuts.length; i++){\n        maxCol = Math.max(maxCol, verticalCuts[i] - verticalCuts[i - 1])\n    }\n    maxCol = Math.max(maxCol, w - verticalCuts[verticalCuts.length - 1])\n    \n    return safeMultiply(maxCol , maxRow, 10**9 + 7);\n};\n\nlet safeMultiply = (a, b, c)=> {\n\tlet x = a * b;\n\tif (!Number.isSafeInteger(x)) {\n\t\treturn Number((BigInt(a) * BigInt(b)) % BigInt(c));\n\t}\n\treturn x % c;\n}\n```
[]