Maximum Good People Based on Statements
Given a 0-indexed 2D integer array statements of size n x n, representing statements made by n people about each other, the task is to determine and print the maximum number of people who can be considered good based on these statements.
In this scenario, there are two types of persons:
- The good person: Always tells the truth.
- The bad person: Might tell the truth or might lie.
Each entry statements[i][j] can take one of the following values:
- 0: Person i states that person j is a bad person.
- 1: Person i states that person j is a good person.
- 2: No statement is made by person i about person j.
Additionally, no person ever makes a statement about themselves, i.e., statements[i][i] = 2 for all 0 ≤ i < n.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)