# https://leetcode.com/problems/find-champion-ii/ from typing import List class Solution: def findChampion(self, n: int, edges: List[List[int]]) -> int: lose_team = [False] * n for [_, b] in edges: lose_team[b] = True champ = -1 for i in range(len(lose_team)): if lose_team[i] == False: if champ != -1: champ = -1 break else: champ = i return champ