Graph Valid Tree
Difficulty: Medium
Category: DSA
Topics: Depth-First Search, Breadth-First Search, Union Find, Graph
Asked at: Amazon, Qualtrics, Microsoft
You are given an integer `n`, representing the number of nodes labeled from `0` to `n - 1`, and a list of undirected edges `edges`, where each edge is represented as a pair `[a, b]` indicating a connection between nodes `a` and `b`.
A graph is considered a **valid tree** if it is **connected** (there is a path between any two nodes) and **acyclic** (contains no cycles).
Return _true_ if the given edges form a valid tree with `n` nodes, and _false_ otherwise.