Amazon Interview Question

They asked Number of islands question