Amazon Interview Question

Leet code style problems of greedy and bfs, dfs