leetle

Daily challenge for 2025-08-08

220. Island Perimeter Calculator

Write a function solve that calculates the perimeter of an island represented in a 2D grid. The grid contains 1s (land) and 0s (water). The island is formed by connecting adjacent 1s horizontally or vertically. Calculate the total perimeter.

Example:
Input: [[0,1,0,0],[1,1,1,0],[0,1,0,0]]
Output: 12

Run this challenge interactively in Python or JavaScript when the app loads.