HTMLify
LeetCode - Find Center of Star Graph - Python
Views: 361 | Author: abh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | class Solution: def findCenter(self, edges: List[List[int]]) -> int: flat = set() for l in edges[:3]: flat.add(l[0]) flat.add(l[1]) for e in flat: center = True for l in edges[:3]: if e not in l: center = False break if center: return e |