Indeed Interview Question

BFS question