Max Area of Island
Updated
Problem statement
Given a rectangular binary matrix grid, return the maximum area of an island.
An island is a maximal group of 1 cells connected horizontally or vertically. Its area is its number of cells. Return 0 when the grid contains no land.
Function
maxAreaOfIsland(grid: int[][]) → intExamples
Example 1
grid = [[0,0,1,0],[1,1,1,0],[0,1,0,1]]return = 5The center island has five cells; the bottom-right cell is a separate area-1 island.
Example 2
grid = [[0,0],[0,0]]return = 0The matrix has no land.
Example 3
grid = [[1]]return = 1The only cell forms an island of area 1.
Constraints
1 <= grid.length, grid[i].length <= 300.- Every row has the same length.
- Every cell is
0or1.
More Bloomberg LP Onsite Interview questions
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Number of Islands with Diagonal ConnectivityGoogle · ONSITE INTERVIEWGoogle interview questions
- Island Count and Maximum AreaOracle · ONSITE INTERVIEWOracle interview questions
- Max Area of IslandGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
- Max Area of IslandRoku · ONSITE INTERVIEWRoku interview questions
- Maximum Area of IslandSambaNova Systems · ONSITE INTERVIEWSambaNova Systems interview questions
- Count Islands in a Binary GridApple · PHONE SCREENApple interview questions
- Pacific Atlantic Water FlowAnduril · PHONE SCREENAnduril interview questions
- Maximum Damage PatchGecko Robotics · OA · PHONE SCREEN
- Maximum Area of IslandSkydio · PHONE SCREENSkydio interview questions
- Number of IslandsFleetx · ONSITE INTERVIEW
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)