Basic C++ Backtracking & Recursive Approach.
Intuition

Given a binary matrix (matrix) and a number numSelect, we need to select numSelect columns such that the maximum number of fully covered rows is achi
# Intuition
- Given a binary matrix (matrix) and a number numSelect, we need to select numSelect columns such that the maximum number of fully covered rows is achieved.

- A row is covered if all 1s in that row exist in at least one of the selected columns.

- The goal is to maximize the number of fully covered rows. 

# Approach
- The algorithm tries all possible ways to select numSelect columns and finds the best selection.

- 1️⃣ Recursively Try Selecting Columns
mxrows(idx, matrix, num, cnt, selected) is the main recursive function.

- We either pick the current column or skip it.

- Base conditions:

        If we selected numSelect columns → count covered rows.

        If we ran out of columns → return 0.

- 2️⃣ Counting Fully Covered Rows
Function cntrows(selected, matrix) counts how many rows are fully covered by selected columns.

        For each row, check if all 1s in that row are covered by some selected column.

- 3️⃣ Take the Maximum
Try both picking and not picking the current column.

        Return max(pick, notpick) to ensure we get the best result.

# Complexity
- Time complexity:
$$O(2^n)$$ n=number of columns 

- Space complexity:
 $$O(n)$$ stack space

# Code
```cpp []
class Solution {
public:
    int cntrows(set<int>& selected, vector<vector<int>>& matrix) 
    {
        int coveredRows = 0;
        
        for (int i = 0; i < matrix.size(); i++) 
        {
            bool covered = true;
            for (int j = 0; j < matrix[0].size(); j++) 
            {
                if (matrix[i][j] == 1 && selected.find(j) == selected.end()) 
                {
                    covered = false;
                    break;
                }
            }
            if (covered) coveredRows++;
        }
        
        return coveredRows;
    }

    int mxrows(int idx, vector<vector<int>>& matrix, int num, int cnt, set<int>& selected) 
    {
        if (cnt == num) 
        {
            return cntrows(selected, matrix);
        }
        if (idx >= matrix[0].size()) 
        {
            return 0;
        }
        
        selected.insert(idx);
        int pick = mxrows(idx + 1, matrix, num, cnt + 1, selected);
        selected.erase(idx);
        int notpick = mxrows(idx + 1, matrix, num, cnt, selected);
        
        return max(pick, notpick);
    }
    
    int maximumRows(vector<vector<int>>& matrix, int numSelect) {
        set<int> selected;
        return mxrows(0, matrix, numSelect, 0, selected);
    }
};

```
['Backtracking', 'Recursion', 'Matrix', 'C++']