The first principles of any DFS algorithms.

How to nail DFS algorithm interviews with both iteration and recursion

Lily Chen
Dev Genius
Published in
5 min readFeb 7, 2022

--

Image by author

When it comes to coding, I like to find patterns. Patterns reveal first principles, and approaching any question from first principle thinking leads to better clarity.

Here are some first principles that often come up during coding interviews.

--

--