There are n points, numbered 0 to n - 1. The list edges has the links between them. An entry edges[i] = [a_i, b_i] means points a_i and b_i are joined, and the link works in both directions.
A set of points and links forms a tree when two things are true: you can get from any point to any other point, and there is no loop anywhere.
Return true if these points and links form a tree. Otherwise return false.
Examples
Example 1:
Input: n = 4, edges = [[0,1],[1,2],[2,3]]
Output: true
Explanation: All 4 points are in one chain with no loop.
Example 2:
Input: n = 5, edges = [[0,1],[0,2],[3,4]]
Output: false
Explanation: The points are in two separate groups, {0, 1, 2} and {3, 4}, so you cannot reach every point.
Example 3:
Input: n = 3, edges = [[0,1],[1,2],[2,0]]
Output: false
Explanation: The three links make a loop.