Amazon interview question

the LC high frequency problem (using dfs or bfs)