Intel Corporation Interview Question

Write a program to count the number of islands