BFS and DFS solution
more elegant solution
code optimization
code optimization