Tap here to switch tabs
Problem
Submissions

Problem: Find Champion I

med
30 min
Try to solve the Find Champion I problem.

Statement

There are n teams numbered from 00 to n−1n - 1 in a tournament.

You are given a two dimensional integer matrix grid of size nimesnn imes n. For any two distinct teams i and j, grid[i][j] == 1 denotes that team i is stronger than team j, whereas grid[i][j] == 0 denotes that team j is stronger than team i.

A team is the champion if there is no other team that is stronger than it.

Return the team that is the champion.

Constraints:

  • n == grid.length

  • n == grid[i].length

  • 2≤2 \leq n ≤100\leq 100

  • grid[i][j] is either 00 or 11.

  • For all i, grid[i][i] is 00.

  • For all i, j such that i != j, grid[i][j] != grid[j][i].

  • The input is generated such that if team a is stronger than team b and team b is stronger than team c, then team a is stronger than team c.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Champion I

med
30 min
Try to solve the Find Champion I problem.

Statement

There are n teams numbered from 00 to n−1n - 1 in a tournament.

You are given a two dimensional integer matrix grid of size nimesnn imes n. For any two distinct teams i and j, grid[i][j] == 1 denotes that team i is stronger than team j, whereas grid[i][j] == 0 denotes that team j is stronger than team i.

A team is the champion if there is no other team that is stronger than it.

Return the team that is the champion.

Constraints:

  • n == grid.length

  • n == grid[i].length

  • 2≤2 \leq n ≤100\leq 100

  • grid[i][j] is either 00 or 11.

  • For all i, grid[i][i] is 00.

  • For all i, j such that i != j, grid[i][j] != grid[j][i].

  • The input is generated such that if team a is stronger than team b and team b is stronger than team c, then team a is stronger than team c.