Skip to content
LC-1791 Easy LeetCode

1791. Find Center of Star Graph

Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 87% Topics: Graph
View full problem on LeetCode

Reading material

Reference solution (spoiler · python)
# Time:  O(1)
# Space: O(1)

class Solution(object):
    def findCenter(self, edges):
        """
        :type edges: List[List[int]]
        :rtype: int
        """
        return edges[0][edges[0][1] in edges[1]]

Solution from kamyu104/LeetCode-Solutions · MIT