Graph Valid Tree

Medium

📝 Description

Determine if a graph is a valid tree (no cycles, fully connected)

Input Format

Number of nodes and list of edges

Output Format

true/false

Constraints

1 ≤ n ≤ 2000

🔍 Sample Input

5
[[0,1],[0,2],[0,3],[1,4]]
            

✅ Sample Output

true
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run