There is an undirected star graph with n nodes. You are given a 2D integer array edges where each edges[i] = [u, v] represents an edge between nodes u and v. Return the center of the star graph — the node connected to every other node.
Input: A 2D array edges where edges[i]=[u,v] represents an edge.
Output: Integer — the center node of the star graph.
Input: [[1,2],[2,3],[4,2]]
Output: 2
Explanation: Node 2 appears in all edges: [1,2],[2,3],[4,2]. Center=2.Input: [[1,2],[5,1],[1,3],[1,4]]
Output: 1
Explanation: Node 1 appears in all edges. Center=1.Input: [[2,1],[3,2],[4,2],[5,2]]
Output: 2
Explanation: Node 2 connects to all others. Center=2.3 <= n <= 10^5edges.length == n-1edges[i].length == 21 <= u, v <= n