Island Perimeter (Round 3, LC 463 :)
Problem Overview
- Compute the perimeter of a single island in a 2D grid where 1 is land and 0 is water.
- Input: int[][] grid with 1 ≤ rows, cols ≤ 100; cells connect 4-directionally; no lakes; exactly one island. Output: integer perimeter.
- Context: grid-based map geometry; measure the island’s border length.
- From Microsoft interviews; a common coding interview task and interview question; classic array/graph problem.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
