HashedIn by Deloitte Interview Question

Find islands using hashmaps, write the code or explain algo