Largest Island After One Land Conversion
Updated
Problem statement
Given a rectangular binary grid, you may change at most one 0 into 1. An island is a four-directionally connected group of ones. Return the largest island area obtainable after the optional conversion.
Function
largestIsland(grid: int[][]) → intExamples
Example 1
grid = [[1,0],[0,1]]return = 3Converting either zero joins both diagonal land cells through the converted cell.
Example 2
grid = [[1,1],[1,0]]return = 4Converting the only zero makes the complete grid one island.
Constraints
1 <= grid.length, grid[i].length <= 500grid[i][j] is 0 or 1four-directional adjacency defines an island
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
- Largest Island After One Land ConversionAmazon · ONSITE INTERVIEW
- Largest Island After One Land ConversionGoogle · ONSITE INTERVIEWGoogle interview questions
- Making a Large IslandMeta · ONSITE INTERVIEWMeta interview questions
- Evaluate DivisionPlaud · ONSITE INTERVIEW
- Count Friend CirclesOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- Redundant ConnectionMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Count Connected Components in an Undirected GraphNutanix · ONSITE INTERVIEWNutanix interview questions
- Connected GroupsFivetran · ONSITE INTERVIEWFivetran interview questions
- Evaluate DivisionApple · PHONE SCREENApple interview questions
- Minimum Unreachable WarehousesVisa · OAVisa interview questions
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)