Problem bank
MediumGraphs LeetCode premiumNeetCode 150 · #91/150

Graph Valid Tree

  1. 1
    Learn the pattern

    Grid or network traversal → BFS for shortest path, DFS for connectivity/shape. Track visited on push.

  2. 2
    Trace your version

    Paste your solution into the workspace and watch every step execute.

    Open workspace
  3. 3
    Solve it

    Note: submitting this one needs a LeetCode premium subscription — the pattern is still worth studying.

Number of Connected ComponentsWord Ladder