Code RoomTeam elimination check
HardPrep Room Coding #1445

Team elimination check

CodingAlgorithms & data structuresSenior–Staff~40 min

A round-robin league has n teams. wins[i] is team i's current win count, remaining_total[i] is the number of games team i still has to play in total, and games[i][j] (a symmetric matrix, games[i][i]=0) is the number of games still to be played between teams i and j. Determine whether team 0 is mathematically eliminated: it is eliminated if there is NO way to assign winners to the remaining games such that team 0 ends with at least as many wins as every other team (ties are allowed, i.e. team 0 only needs to be co-leader). Return True if eliminated, else False. Constraints: 2 <= n <= 30; counts fit in normal ints.

Implement
is_eliminated(wins: list[int], remaining_total: list[int], games: list[list[int]]) → bool
Examples
in[[2,3,3],[3,1,1],[[0,2,1],[2,0,0],[1,0,0]]]outfalse
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 40 min
InputExpectedGot
[[2,3,3],[3,1,1],[[0,2,1],[2,0,0],[1,0,0]]]falsenot run yetsample