Javascript || Clean Code || Detailed Explanation || BigInt
Calculate max area, we need to have max height and max width\n\n1. How to find max height and max width\n\n\tA height of a cut is the distance between two horiz
Calculate **max area**, we need to have **max height** and **max width**\n\n1. How to find max height and max width\n\n\tA height of a cut is the distance between two horizontal cut. 0 and h is also consider as **a cut**\n\tA width of a cut is the distance between two vertical cut. 0 and w is also consider as **a cut**\n\n\tNote: `horizontalCuts` and `verticalCuts` need to be sorted as there is no guarantee that it is sorted. \n\n2. Once we found the max height and max width, max area is just **max width * max height**\n\n\tNote: Handle BigInt in Javascript can be quite tricky \n\t\t```BigInt(maxHeight) * BigInt(maxWidth) % 1000000007n```\n\n\n\n\n\n\n\n```\n/**\n * @param {number} h\n * @param {number} w\n * @param {number[]} horizontalCuts\n * @param {number[]} verticalCuts\n * @return {number}\n */\nconst maxArea = (h, w, horizontalCuts, verticalCuts) => {\n  horizontalCuts.sort((h1, h2) => h1 - h2)\n  verticalCuts.sort((v1, v2) => v1 - v2)\n  \n  let maxHeight = Math.max(horizontalCuts[0], h - horizontalCuts[horizontalCuts.length - 1])\n  let maxWidth = Math.max(verticalCuts[0], w - verticalCuts[verticalCuts.length - 1])\n  \n  for (let i = 1; i < horizontalCuts.length; i++) {\n    maxHeight = Math.max(maxHeight, horizontalCuts[i] - horizontalCuts[i - 1])\n  }\n  \n  for (let j = 1; j < verticalCuts.length; j++) {\n    maxWidth = Math.max(maxWidth, verticalCuts[j] - verticalCuts[j - 1])\n  }\n  \n  return BigInt(maxHeight) * BigInt(maxWidth) % 1000000007n\n};\n```
['JavaScript']