Given n nodes labeled 0..n-1 and a list of undirected edges, determine whether the edges form a valid tree — the graph is fully connected and contains no cycle. Return true or false. The input is JSON {n, edges}.
Input: JSON {n, edges}.
Output: Boolean — true or false.
Input: {"n":5,"edges":[[0,1],[0,2],[0,3],[1,4]]}
Output: true
Explanation: Connected and acyclic.Input: {"n":5,"edges":[[0,1],[1,2],[2,3],[1,3],[1,4]]}
Output: false
Explanation: Contains a cycle.Input: {"n":1,"edges":[]}
Output: true
Explanation: A single node.1<=n<=2000