Search⌘ K
AI Features

DIY: Number of Islands

Explore techniques to count distinct islands in a 2D grid map, where islands are clusters of adjacent lands. Learn to implement a Kotlin function that processes the grid to return the correct number of island groups, preparing you for real-world coding interview problems.

Problem statement

Given an m x n 2D grid map of 1's (land) and 0's (water), return the number of islands.

An island is surrounded by water and is ...