Easy & Logical Brute-Force
\nclass Solution\n{\npublic:\n    // global var that keeps track of max good people possible\n    int maxGood;\n\n    int maximumGood(vector<vector<int>> &state
```\nclass Solution\n{\npublic:\n    // global var that keeps track of max good people possible\n    int maxGood;\n\n    int maximumGood(vector<vector<int>> &statements)\n    {\n        maxGood = 0;\n\n        // vector that we treat everytime as truth\n        vector<int> people(statements.size(), 2);\n\n        helper(0, people, statements);\n        return maxGood;\n    }\n\n    void helper(int person, vector<int> people, vector<vector<int>> &statements)\n    {\n        // base case, count number of good people\n        if (person >= people.size())\n        {\n            int count = 0;\n            for (int i : people)\n                if (i == 1)\n                    count++;\n\n            // replace with maxGood if greater\n            maxGood = max(maxGood, count);\n            return;\n        }\n\n        // if person has already been established as bad, don\'t listen to him\n        if (people[person] == 0)\n        {\n            // call recursively on next person\n            helper(person + 1, people, statements);\n            return;\n        }\n\n        // if person has not been established as being bad or good\n        else if (people[person] == 2)\n        {\n            // try them as bad person\n            people[person] = 0;\n\n            // perform recursion\n            helper(person + 1, people, statements);\n        }\n\n        // otherwise, if he is already established as good person, or if not established, try him as good person\n        people[person] = 1;\n\n        // go to his statement\n        for (int i = 0; i < people.size(); i++)\n        {\n            // establish who he says is good as good\n            if (statements[person][i] == 1)\n            {\n                // check for contradiction (if he says someone is good and we have already established them as bad)\n                if (people[i] == 0)\n                    return;\n\n                // make them good\n                people[i] = 1;\n            }\n\n            // else if he says they are bad, make them bad\n            else if (statements[person][i] == 0)\n            {\n                // check for contradiction (if he says someone is bad and we have already established them as good)\n                if (people[i] == 1)\n                    return;\n                people[i] = 0;\n            }\n        }\n\n        // perform same on next person using our truth vector\n        helper(person + 1, people, statements);\n    }\n};\n\n```
['C++']