1791. Find Center of Star Graph ¶ Time: $O(1)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6 7 8class Solution { public: int findCenter(vector<vector<int>>& edges) { return edges[0][0] == edges[1][0] || edges[0][0] == edges[1][1] ? edges[0][0] : edges[0][1]; } }; 1 2 3 4 5 6 7class Solution { public int findCenter(int[][] edges) { return edges[0][0] == edges[1][0] || edges[0][0] == edges[1][1] // ? edges[0][0] : edges[0][1]; } } 1 2 3 4 5class Solution: def findCenter(self, edges: list[list[int]]) -> int: if edges[0][0] in edges[1]: return edges[0][0] return edges[0][1]