Snowflake interview question

Graph question, best path problem.