Java - Bitmask solution
Intuition - \nn <= 15 from the constraints, which means all combinations gives us time complexity of O(2^15) ~= O(4\10^4). And travesing through the statements 
Intuition - \nn <= 15 from the constraints, which means all combinations gives us time complexity of O(2^15) ~= O(4\\*10^4). And travesing through the statements array for every combiantion is another 15\\*15 ~= 200. Time Complexity  O(10^6). Therefore a bruteforce solution works.\nTo iterate through all the combinations we can use a bitmask and check for the combination if it is a valid combination. \n```\nclass Solution {\n    // efficient way to calculate set bits in an integer\n    private int calculateOnes(int n){\n        int count = 0;\n        while (n>0) {\n            n &= (n - 1);\n            count++;\n        }\n        return count;\n    }\n    private boolean isPossible(int[][] statements, int mask){\n        int n = statements.length;\n        for(int i=0;i<n;i++){\n            //mask 0 for ith person means he may be lying\n            // so we do not consider his statement\n            if(((mask>>i) & 1) !=1) continue;\n            for(int j=0;j<n;j++){\n                //if he is saying jth person is bad but mask says he is good - contradiction\n                if(statements[i][j]==0){\n                    if(((mask>>j) & 1 )==1) return false;\n                }\n                //contradiction here as well so this combination is not valid \n                else if(statements[i][j]==1){\n                    if(((mask>>j) & 1)==0) return false;\n                }\n            }\n        }\n        // there is no contradiction between statements and our mask\n        return true;\n    }\n    public int maximumGood(int[][] statements) {\n        int n = statements.length;\n        int max = 0;\n        for(int i=0;i<(1<<n);i++){\n            if(isPossible(statements, i)){\n                max = Math.max(max, calculateOnes(i));\n            }\n        }\n        return max;\n    }\n}\n```\n
['Bitmask', 'Java']