Snowflake interview question

It was a graph question with medium difficulty.