Applied Intuition interview question

Question based on graph search.