Maximum Good People Based on Statements
A hard-tier problem at 51% community acceptance, tagged with Array, Backtracking, Bit Manipulation. Reported in interviews at TuSimple and 0 others.
Maximum Good People Based on Statements is a hard problem that requires you to figure out which people in a group are telling the truth based on conflicting statements. TuSimple has asked it. The trap is obvious: you can't just trust everyone or distrust everyone. You need to test all possible truth assignments until you find the maximum-sized consistent group. With a 51% acceptance rate, most candidates either miss the enumeration angle or mishandle the validation logic. If this hits your live OA and the backtracking doesn't click, StealthCoder surfaces the working solution in seconds, invisible to the proctor.
Companies that ask "Maximum Good People Based on Statements"
Maximum Good People Based on Statements is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by a senior engineer who knows the OA is theater. This is the script.
Get StealthCoderThe core insight is that you must enumerate all possible subsets of people and check which ones are internally consistent (no contradictions between their statements). For each subset, verify that every person in it is consistent with every other person's claims about the group. This is a brute-force enumeration problem: there are 2^n possible truth assignments, and you validate each one in O(n^2) time. Bit manipulation makes it clean to represent subsets and iterate through them. Most candidates fail because they try to greedily include or exclude people without testing all combinations. Others botch the validation step, not properly checking that both directions of a statement agree. The backtracking and enumeration topics signal that this is a search problem without a polynomial-time shortcut. If you freeze on the validation logic during the assessment, StealthCoder handles it.
Pattern tags
You know the problem.
Make sure you actually pass it.
Maximum Good People Based on Statements recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Maximum Good People Based on Statements interview FAQ
Why can't I just greedily pick people who make true claims?+
Because you don't know who's telling the truth until you've built a consistent group. A person's claim about someone else only makes sense if both are in the same subset and agree. You must test all subsets, not optimize early.
Is this problem still asked at TuSimple?+
TuSimple is reported in our data as having asked it. It's a solid hard-level problem for testing algorithmic thinking and validation logic, common in backend and infrastructure roles.
What's the trick to the validation step?+
For each person in your candidate group, check their statement about every other person. If they claim someone is good (1), that person must be in the group. If they claim someone is bad (0), that person must not be in the group. Both directions must hold.
How does bit manipulation help here?+
Use an integer bitmask to represent which people are in your 'good' subset. Iterate from 0 to 2^n-1, and for each mask, run validation in O(n^2). Bit operations make iteration and membership checks fast.
What's the time complexity and is it acceptable?+
O(2^n * n^2) because you enumerate all subsets and validate each in quadratic time. With n typically small (around 15), this is feasible. No better algorithm is known; the problem is NP-hard.
Want the actual problem statement? View "Maximum Good People Based on Statements" on LeetCode →