Easy C++ Explanation with comment
\n\nclass Solution {\n    \n    int f(vector<vector<int>>& mat, vector<int> &v, int r){\n        \n        int ans = 0;\n        bool flag = true;\n        \n  
```\n\nclass Solution {\n    \n    int f(vector<vector<int>>& mat, vector<int> &v, int r){\n        \n        int ans = 0;\n        bool flag = true;\n        \n        for(int i = 0; i < r; i++){\n            \n\t\t\t/*\n\t\t\twe are taking each row at one time and iterating through it\t\t\t\n\t\t\t*/\n            vector<int> row = mat[i];\n            \n            for(int j = 0; j < row.size(); j++){\n                \n\t\t\t\t/*\n\t\t\t\tif all the element in that particular row are 0, then flag will remain true and ans will get increased.\n\t\t\t\tif any element is 1 in that particular row then we will check if that 1 is covered by coloumn or not\n\t\t\t\tif yes flag will remain true\n\t\t\t\tif no flag will be false\n\t\t\t\t*/\n                if(row[j] == 1){\n                    if(!count(v.begin(), v.end(), j)){\n                        flag = false;\n                    }\n                }\n            }\n\t\t\t/*\n\t\t\tit remains true , it means all 1 are covered by coloums\n\t\t\tor there are no 1 ie all are Zero\n\t\t\tSo, we will increased our ans, since one more row is covered .\n\t\t\t*/\n            if(flag) ans++;\n\t\t\t/*\n\t\t\tnow we have to check the next row , so we are again making it true\n\t\t\t*/\n            flag = true;\n        }\n        \n        \n        return ans;\n        \n    }\n  \n  /*\n  https://stackoverflow.com/questions/12991758/creating-all-possible-k-combinations-of-n-items-in-c\n  Refer this to understand comb function.\n  */\nvoid comb(int N, int K, vector<vector<int>> &combi)\n{\n    string bitmask(K, 1); // K leading 1\'s\n    \n    bitmask.resize(N, 0); // N-K trailing 0\'s\n \n    vector<int> ans;\n    // print integers and permute bitmask\n    do {\n        for (int i = 0; i < N; ++i) // [0..N-1] integers\n        {\n            if (bitmask[i]) {\n                ans.push_back(i);\n            }\n        }\n        // cout << std::endl;\n        combi.push_back(ans);\n        ans.clear();\n        \n    } while (prev_permutation(bitmask.begin(), bitmask.end()));\n}\n    \npublic:\n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        \n        int r = mat.size();\n        \n        int maxi = 0;\n        \n        vector<vector<int>> combi;\n        \n\t\t/*comb function will generates all possible column combination \n\t\teg if cols = 2, mat[0].size() = 3 (if the matrix has 3 columns)\n\t\tit means we have to select any 2 columns out of 3 columns(0,1,2)\t\t\n\t\t*/\n        comb(mat[0].size(), cols, combi);\n        \n       \n\t\t/*\n\t\tcombi will have:\n\t\t\t0, 1\n\t\t\t0, 2\n\t\t\t1, 2\t\t\n\t\t*/\n        \n        for(int i = 0; i < combi.size(); i++){\n           \t\t\t\n            /*\n\t\t\tNow we are passing each combination of column to the f function\n\t\t\twhen i = 0 :  0, 1\n\t\t\t\t i = 1 :  0, 2\n\t\t\t\t i = 2 :  1, 2\n\t\t\t*/\n            maxi = max(f(mat,combi[i],r),maxi);\n        }\n        \n        \n        return maxi;\n    }\n};\n```\nIf anything is not understandable, comment it . I will try to explain.\nPlease, upvote it if it helps you :)
['C++']