← Questions
Number of islands as land is added
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A grid starts as all water. Positions are turned into land one at a time; after each addition, return the current number of islands (land cells connected up, down, left or right). Use union-find so each addition is nearly constant time.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding

