C++ || Bit Manipulation || Easy approach
Here is my c++ code for this problem.\n\n# Complexity\n- Time complexity:O(2^n * n^2)\n\n- Space complexity:O(1)\n\n# Code\n\nclass Solution {\npublic:\n    int
Here is my c++ code for this problem.\n\n# Complexity\n- Time complexity:$$O(2^n * n^2)$$\n\n- Space complexity:O(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int maximumGood(vector<vector<int>>& statements) {\n        int ans=0;\n        for(int i=1; i<(1<<statements.size()); i++){\n            int chk=1;\n            for(int j=0; j<statements.size(); j++){\n                if(!(i&(1<<j))){\n                    continue;\n                }\n                for(int k=0; k<statements.size(); k++){\n                    if((i&(1<<k)) && statements[j][k]==0){\n                        chk=-1; break;\n                    }\n                    else if(!(i&(1<<k)) && statements[j][k]==1){\n                        chk=-1; break;\n                    }\n                }\n                if(chk==-1){break;}\n            }\n            if(chk==1){\n                int cnt=0;\n                int n1=i;\n                while(n1>0){\n                    if(1&n1){cnt++;}\n                    n1=n1>>1;\n                }\n                ans=max(ans, cnt);\n            }\n        }\n        return ans;\n    }\n};\n```
['Array', 'Bit Manipulation', 'Enumeration', 'C++']