Easy working solution in PYTHON || C++
Maximum Area of a piece of Cake After Horiziontal and Vertical Cuts\n\nTo find the area of the maximum part of give 2D Array or cake we need to focus on the max
**Maximum Area of a piece of Cake After Horiziontal and Vertical Cuts**\n\nTo find the area of the **maximum part** of give 2D Array or cake we need to focus on the maximum cuts that we can get and its only possible if the difference between the **value of cuts** are maximum, like it should cover maximum part. \n\nWe need to take **sorted arrays** as we can\'t traverse back and want **linear time complexity** which will help in doing the work in less time and we will be able to get **maximum area**. \n\nFollowing is the code in PYTHON : \n\n```\ndef maxArea(self, h, w, horizontalCuts, verticalCuts):\n        """\n        :type h: int\n        :type w: int\n        :type horizontalCuts: List[int]\n        :type verticalCuts: List[int]\n        :rtype: int\n        """\n        h_mx = 0  \n\n        horizontalCuts.sort()\n        verticalCuts.sort()\n\n        for i in range(len(horizontalCuts)-1):\n            r = horizontalCuts[i+1] - horizontalCuts[i]\n            if h_mx < r:\n                h_mx =  r\n\n        if h_mx < h - horizontalCuts[-1]:\n            h_mx = h - horizontalCuts[-1]\n\n        if h_mx < horizontalCuts[0] - 0:\n            h_mx = horizontalCuts[0] - 0\n\n        v_mx = 0\n\n        for i in range(len(verticalCuts)-1):\n            r = verticalCuts[i+1] - verticalCuts[i]\n            if v_mx < r:\n                v_mx =  r\n\n        if v_mx < w - verticalCuts[-1]:\n            v_mx = w - verticalCuts[-1]\n\n        if v_mx < verticalCuts[0] - 0:\n            v_mx = verticalCuts[0] - 0\n        \n\n        return (h_mx * v_mx)\n```\n\nFirst we need to store the max value of cuts in such a way we will get the maximum possible area in the same way we need the maximum cut for vertical array and finally we will return the multiplication of both the cuts. \n\nDon\'t forget to add the modulus of 10^9 as we are asked to return back the ans as a modulus of it.\n\n**C++ Code:**\n\n```\nint maxArea(int h, int w, vector<int>& horizontalCuts, vector<int>& verticalCuts) {\n        \n        int h_mx =  0;\n        int v_mx = 0;\n\n        sort(horizontalCuts.begin(), horizontalCuts.end());\n        sort(verticalCuts.begin(), verticalCuts.end());\n\n        int n = horizontalCuts.size();\n        int m = verticalCuts.size();\n\n        for(int i=0;i<n-1;i++)\n        {\n            int r = horizontalCuts[i+1] - horizontalCuts[i];\n            if(h_mx<r) h_mx = r;\n        }\n        if(h_mx<horizontalCuts[0] - 0)\n        {\n            h_mx = horizontalCuts[0] - 0;\n        }\n\n        if(h_mx < h-horizontalCuts[n-1])\n        {\n            h_mx = horizontalCuts[n-1];\n        }\n\n        for(int i=0;i<m-1;i++)\n        {\n            int r = verticalCuts[i+1] - verticalCuts[i];\n            if(v_mx<r) v_mx = r;\n        }\n\n        if(v_mx<verticalCuts[0] - 0)\n        {\n            v_mx = verticalCuts[0] - 0;\n        }\n\n        if(v_mx < h-verticalCuts[m-1])\n        {\n            v_mx = verticalCuts[m-1];\n        }\n\n        return (1LL * h_mx * v_mx)% 1000000007 ;\n    }\n```
['C', 'Python', 'Python3']