← Zoho questions

Count islands in a matrix

Filed under Zoho · Also reported at Cruise

Given an N x N matrix where 1 represents land and -1 represents ocean, calculate the total number of connected islands. An island is formed by connecting adjacent land cells horizontally or vertically…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Zoho questions

Collected from public candidate posts and coding forums. Updated Nov 2026.