Easy Way || Sorting || Prefix Array || CPP || Matrix
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int largestSubmatrix(vector<vector<int>>& matrix) {\n        int n=matrix.size();\n        int m=matrix[0].size();\n        vector<vector<int>>ans(n,vector<int>(m,0));\n        for(int i=0;i<m;i++){\n            int k=1;\n            int p=0;\n            if(matrix[0][i]==0){\n                ans[0][i]=0;   \n            }\n            else{\n                ans[0][i]=1;\n            }\n\n            for(int j=1;j<n;j++){\n                if(matrix[j][i]==0){\n                    ans[j][i]=0;\n                    continue;\n                }\n                ans[j][i]=ans[j-1][i]+1;\n            }\n\n        }\n\n\n        int fans=0;\n       for(int i=0;i<n;i++){\n           sort(ans[i].begin(),ans[i].end());\n\n           for(int j=m-1;j>=0;j--){\n               fans=max(fans,(m-j)*ans[i][j]);\n           }\n\n       }\n        return fans;\n    }\n};\n```
['Array', 'Sorting', 'Matrix', 'C++']