Intermediate · Coding interviews: lists, trees and graphs
Depth-first search
Six interview problems a depth-first search answers, kept on a stack of its own: rooms opened by the keys inside, regions of a board cut off from its edge, rain that reaches two oceans, a cycle among steps, the longest climb through a grid, and ratios from equations.
- You build
- keys.py, then regions.py, then oceans.py, then cycle.py, then climb.py, then ratios.py
- Stages
- 6 Problems
- Time
- About 2.5 hours
Loading the workspace…
Loading the workspace…