n teams numbered 0 to n - 1. For every pair of teams we know which one is stronger, recorded in an n × n matrix beats. For i ≠ j, beats[i][j] == 1 means team i is stronger than team j, and 0 means the opposite. The diagonal is all zeros.
The champion is the team that no other team is stronger than. A champion is guaranteed to exist. Return its number.beats=[[0, 0, 0], [1, 0, 1], [1, 0, 0]] → 1
Team 1 is stronger than teams 0 and 2, and no one is stronger than team 1.
beats=[[0, 1], [0, 0]] → 0
There are only two teams, and team 0 is stronger than team 1.
beats=[[0, 0, 0], [1, 0, 1], [1, 0, 0]]
1
Run checks the first 3 tests in your browser. Submit checks all 13 tests on the server, hidden ones included.