Apple Interview Question

Two pointers, DFS, BFS, sliding window, etc