DFS on Trees: Three Patterns I Keep Seeing in Coding Interviews

When I first learned Depth First Search (DFS), I thought of it as a tree traversal technique.