Amazon OA August-2025 | Server Clusters & Matrices | Number of Islands
Amazon · Question · Posted Jun 2026
Question: Number of Islands Problem Statement Given an M x N 2D binary grid which represents a map of 1s (land) and 0s (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Input Format The first line contains T - the number of test cases. For each test case, the first line contains ...
The full answer & interview discussion are available to premium members.
Log in Create a free account