Number of Islands II
An m x n grid starts as all water. Land cells are added one by one. After each addition print the current number of islands (4-directionally connected land).
Constraints
1 <= m, n, p <= 10^4 (m * n <= 10^5)
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.