LiveRamp interview question

Simple BFS question