PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates a candidate's ability to perform grid-based graph traversal and manage visited state, testing algorithmic skills in connected components and traversal techniques within algorithms and data structures.

  • Medium
  • Amazon
  • Coding & Algorithms
  • Software Engineer

Find largest island area

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

##### Question Given a 2D grid of 0s and 1s, find the largest area of a connected group of 1s (island) using 4-directional adjacency; return that area. (Variant of LeetCode 695 Max Area of Island.) https://leetcode.com/problems/max-area-of-island/description/

Quick Answer: This question evaluates a candidate's ability to perform grid-based graph traversal and manage visited state, testing algorithmic skills in connected components and traversal techniques within algorithms and data structures.

Given a rectangular 2D grid of 0s and 1s, return the area of the largest island. An island is a maximal group of 1s connected 4-directionally (up, down, left, right). The area is the number of cells with value 1 in the island. If no land exists, return 0.

Constraints

  • 1 <= m, n <= 200
  • grid is an m x n matrix of integers
  • grid[i][j] is 0 or 1
  • Adjacency is 4-directional only
  • Expected time complexity: O(m*n)

Hints

  1. Use DFS or BFS to explore each unvisited land cell and compute its island area.
  2. Track visited cells to avoid recounting and infinite loops.
  3. Check bounds carefully when exploring the four neighbors of a cell.
Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Minimum Path Length Through a Grid With One Allowed Cell Conversion - Amazon (medium)
  • Circular Drone Hub Delivery Route - Amazon (hard)
  • Leaf Domain Cumulative Scores - Amazon (medium)
  • Kth Largest Perfect Binary Subtree - Amazon (medium)
  • Find Conflicting Events - Amazon (medium)