Expedia Group Interview Question

BFS and DFS pseudo code