You are reading a single comment by @Greenbank and its replies.
Click here to read the full conversation.
-
I didn't use a stack for day 11, I just marked cells that had already flashed that step with a special entry so I could stop it processing a cell more than once per step. That way is was just a relatively simple DFS.
https://gist.github.com/alexgreenbank/7a9123f8bd1aec310d75836f8946596b
Greenbank
frankenbike
I appreciate the advice, I'm considering these interview practice 🙂
Would that not be more like a BFS though? I'm going to visit each neighbour before I visit any neighbours of neighbours right? Suppose you could insert into the stack instead. Not that it matters whether we use BFS/DFS in the problems we've had so far