Island Size Existence Query API

Given a 2D grid of '0' (water) and '1' (land), where horizontally or vertically adjacent land cells belong to the same island, implement IslandSizeIndex:

  1. Initialize it with the grid.
  2. Prec...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: