eBay Interview Question

DFS, BFS Algorithm Problem. It was not a difficult problem.