Expedia Group interview question

BFS and DFS pseudo code