SLB interview question

Write code for DFS and BFS