Practice Maximum Good People Based on Statements
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Maximum Good People Based on Statements
Problem Statement
A good person always tells the truth; a bad person may either lie or tell the truth. In statements[i][j], 0 means person i says j is bad, 1 means i says j is good, and 2 means no statement is made. Everyone’s self-entry is 2. Find an assignment of good and bad people consistent with every statement made by good people, and return the maximum possible number of good people. Statements by bad people impose no truth requirement.
Source: Maximum Good People Based on Statements on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
statements = [[2,1,2],[1,2,2],[2,0,2]]
2
# Example 2
statements = [[2,0],[0,2]]
1
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Good People Based on Statements.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.