Bloomberg Interview Question

Number of islands (DFS), sliding window