Bit Manipulation || Easy to understand || Power Set || C++
Complexity\n- Time complexity:O(2^n * n^2)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complexity here, e.g. O(n) \n
# Complexity\n- Time complexity:$$O(2^n * n^2)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool check(int mask, int n, vector<vector<int>>& grid){\n        for(int i=0; i<n; i++){\n            for(int j=0; j<n; j++){\n                bool isIGood = (mask >> i) & 1;\n                bool isJGood = (mask >> j) & 1;\n                if(grid[i][j] == 1 && isIGood && !isJGood) return false;\n                if(grid[i][j] == 0 && isIGood && isJGood) return false;\n            }\n        }\n        return true;\n    }\n    int maximumGood(vector<vector<int>>& grid) {\n        int n = grid.size();\n        int ans = 0;\n        for(int i=1; i<(1<<n); i++){\n            if(check(i, n, grid)) ans = max(ans, __builtin_popcount(i));\n        }\n        return ans;\n    }\n};\n```
['C++']