Leetcode 1791 - Find Center of Star Graph [27/6/24]

Поделиться
HTML-код
  • Опубликовано: 25 июн 2024
  • Time Taken: ~5 mins
    Tag: LeetCode Easy
    Basic ideas:
    - Star graph has all nodes connected to centre node. Therefore, frequency of all nodes is 1, except for centre node.
    - Based on the above,
    - Take the first 2 elements of edges and check which value is repeated more than once. That is the value of the central node of star graph.

Комментарии •