leetle

Daily challenge for 2025-01-12

12. Count Islands (Square)

Write a function solve that counts the number of islands in a square 2D grid. An island is surrounded by water (0s) and is formed by connecting adjacent lands (1s) horizontally or vertically.

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

Output: 3

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