Search⌘ K
AI Features

DIY: Number of Islands

Explore how to solve the number of islands problem in a 2D grid using Ruby. Understand how to identify connected land regions and implement a solution that counts separate islands, a common coding interview challenge from companies like Facebook.

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 ...