C++ | Easy-Understanding Backtracking Solution
\t#define ll int\n\tclass Solution {\n\tpublic:\n    ll maxi =0;\n    ll n,m;\n    void f (ll col,ll curcol, vector> &mat, vector> &dummy){        \n        if(
\t#define ll int\n\tclass Solution {\n\tpublic:\n    ll maxi =0;\n    ll n,m;\n    void f (ll col,ll curcol, vector<vector<int>> &mat, vector<vector<int>> &dummy){        \n        if(col==0){\n            ll rows =0;       \n            // count how many rows are filled with 0 values\n            for(int i=0;i<n;i++){\n                bool ok = true;\n                for(ll j=0;j<m;j++){                    \n                    if(dummy[i][j]==1) {\n                        ok=false; \n                        break;\n                    }\n                }                \n                if(ok) rows++;\n            }\n            maxi=max(maxi,rows);\n            return;\n        }\n        if(curcol==m) return;\n        for(int i=0;i<n;i++){\n            dummy[i][curcol]=0;\n            // if we are taking the current col fill that col with 0 \n        }\n        // take the current col \n        f(col-1,curcol+1,mat,dummy);\n        \n        for(int i=0;i<n;i++){\n            dummy[i][curcol]= mat[i][curcol]; \n            // backtrack the original values \n        }\n        // ignore the current col\n        f(col,curcol+1,mat,dummy);\n\n    }\n    int maximumRows(vector<vector<int>>& matrix, int numSelect) {\n        n = matrix.size(), m = matrix[0].size();\n        vector<vector<ll>> dummy;\n        dummy = matrix;\n        f(numSelect,0,matrix,dummy);\n        return maxi;\n    }\n};
['Backtracking', 'Recursion', 'C']