All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g2901_3000.s2923_find_champion_i.Solution Maven / Gradle / Ivy

There is a newer version: 1.37
Show newest version
package g2901_3000.s2923_find_champion_i;

// #Easy #Array #Matrix #2023_12_29_Time_1_ms_(96.00%)_Space_45.2_MB_(6.05%)

public class Solution {
    public int findChampion(int[][] grid) {
        int champion = grid[1][0];
        for (int opponent = 2; opponent < grid.length; opponent++) {
            if (grid[opponent][champion] != 0) {
                champion = opponent;
            }
        }
        return champion;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy