Pachyderm Interview Question

DFS and Array Logic leet code