Count islands in a binary grid
Company: Samsung
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
Overview: This question evaluates a candidate's ability to analyze grid-based data structures and identify connected components, testing spatial adjacency reasoning and state management within 2D arrays.
Examples
Input: ([['1', '1', '0'], ['0', '1', '0'], ['1', '0', '1']],)
Expected Output: 3
Explanation: Diagonal land is separate.
Input: ([],)
Expected Output: 0
Explanation: Empty grid.