[C++] Bitmask
A brute force question where we just have to check every pattern.\n\nIn the check function if the cur which represents the current person reaches the end of the
A brute force question where we just have to check every pattern.\n\nIn the check function if the cur which represents the current person reaches the end of the array we check whether the given pattern is valid or not.\n \nIf 1 then good else if 0 then a bad person.\n\nTo check the pattern we will go through our mask and consider only the good people the statements of which we can trust.\nWe will then check the statements of all the good people we assumed.\nIf the statement of the assumed good person does not match with statement vector given then we will return false.\n\n       person id =>  `3  2  1`\nExample: mask => 1  0  1 ,this is a mask so the `1` at the right means the `0th` person in our statement vector. \n\nstatements vector :\n[[2,0,1],  => 2 won\'t be consider and the rest is proper according to mask\n[0,1,1],  => in the mask, value is 0 so we won\'t consider these statements\n[0,2,1]]  => person 3 states that person 1 is bad but in our mask the value is 1 so contradictory statement so the mask should not be considered.\n\n```\nclass Solution {\npublic:\n    int n;\n    \n    int check(int cur,vector<vector<int>>&statements,int mask){\n        if(cur==n){\n            for(int i=0;i<n;i++){\n                if((mask&(1<<i))){\n                    for(int j=0;j<n;j++){\n                        int val = (mask&(1<<j))?1:0;\n                        if(statements[i][j]!=2 && statements[i][j]!=val){\n                            return INT_MIN;\n                        }\n                    }\n                }\n            }\n            return 0;\n        }\n        int a = check(cur+1,statements,mask);\n        int b = 1+check(cur+1,statements,(mask|(1<<cur)));\n        return max(a,b);\n    }\n    \n    int maximumGood(vector<vector<int>>& statements) {\n        n=statements.size();\n        int res = check(0,statements,0);\n        return res<0?0:res;\n    }\n};\n```
['C', 'Bitmask']