O(n^2log(n)) 100% better time complexity[C++}
Detail Description Is In Code Itself\nIf You like My Code Then Please Upvot\n\nclass Solution {\npublic:\n    int largestSubmatrix(vector<vector<int>>& matrix) 
**Detail Description Is In Code Itself**\nIf You like My Code Then Please Upvot\n```\nclass Solution {\npublic:\n    int largestSubmatrix(vector<vector<int>>& matrix) \n    {\n        int row=matrix.size(),col=matrix[0].size();\n        int sum[row][col];\n        // calculate no of 1\'s continue in the column\n        for(int i=0;i<col;i++)\n        {\n            int h=0;\n            for(int j=0;j<row;j++)\n            {\n                if(matrix[j][i]==0)\n                {\n                    h=0;\n                    sum[j][i]=0;\n                }\n                else\n                {\n                    h+=1;\n                    sum[j][i]=h;\n                }\n            }\n        }\n        int ans=0;\n        for(int i=0;i<row;i++)\n        {\n            // sort the arry in row wise\n            sort(sum[i],sum[i]+col);\n            for(int j=0;j<col;j++)\n            {\n                ans=max(ans,(col-j)*sum[i][j]);\n                //why?\n                //because if we think this arry\n                //1 1 1 1\n                //1 0 1 0\n                //0 0 0 0\n                //0 0 1 0\n                //1 1 1 1\n                //1 1 1 1\n                //0 0 0 0\n                //0 1 0 1\n                //then after counting no of continue\'s 1\'s in the arry \n                /*1 1 1 1\n                  2 0 2 0\n                  0 0 0 0\n                  0 0 1 0\n                  1 1 2 1\n                  2 2 3 2\n                  0 0 0 0\n                  0 1 0 1\n                and after sorting arry in row wise we get this arry\n                  1 1 1 1\n                  0 0 2 2\n                  0 0 0 0\n                  0 0 0 1\n                  1 1 1 2\n                  2 2 2 3\n                  0 0 0 0\n                  0 0 1 1\n                  now from doing this \n                  if we think for first row and first element then we ansure\n                  that after [0,0] we get gretaer then or equal 1 element\n                  so we multiply 1 with (4-0) and we get 4 as local max element\n                  now if we think about 5\'th row(0 based) then in first element we \n                  got 2 and now from 2 we can think that after [5,0] element other element are \n                  grater then or equal to 2 so definetly after [5,0] we have more 1\'s(means greter then 2) so directly\n                  multiply 2 with 4 and get ans as 8\n                */\n                \n            }\n            \n        }\n        return ans;\n        \n    }\n};\n```
[]