c++ | easy to undersatand | step by step
```\nclass Solution {\npublic:\n    int n, ans=0;\n    vector row_sums;\n    \n    int sumOfRow(vector &vec){\n        int res=0;\n        for(auto a:vec) res+=
```\nclass Solution {\npublic:\n    int n, ans=0;\n    vector<int> row_sums;\n    \n    int sumOfRow(vector<int> &vec){\n        int res=0;\n        for(auto a:vec) res+=a;\n        return res;\n    }\n    \n    int isPossible(vector<int> &a, vector<int> &b){\n        int res=0;\n        for(int i=0; i<a.size(); i++){\n            if(a[i]==b[i]) res++;\n            else continue;\n        }\n        return res;\n    }\n    \n    void helper(vector<vector<int>>& matrix, int c, int count, vector<int> c_sums){\n        if(c==matrix[0].size()){\n            if(count==n){\n                int temp=isPossible(c_sums, row_sums);\n                if(temp)\n                    ans=max(ans, temp);\n            }\n            return;\n        }\n        \n        helper(matrix, c+1, count, c_sums);\n        \n        for(int i=0; i<matrix.size(); i++){\n            c_sums[i]+=matrix[i][c];\n        }\n        helper(matrix, c+1, count+1, c_sums);\n    }\n    \n    int maximumRows(vector<vector<int>>& matrix, int numSelect) {\n        n=numSelect;\n        for(auto a:matrix){\n            row_sums.push_back(sumOfRow(a));\n        }\n        \n        vector<int> c_sums(matrix.size(), 0);\n        helper(matrix, 0, 0, c_sums);\n        return ans;\n    }\n};
[]