This problem teaches the boundary-first DFS pattern — identifying what NOT to capture is easier than identifying what to capture.
Enable JavaScript for the full StreamPrep guide.