You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Java/Number of Islands II.java
+13-2Lines changed: 13 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,16 @@
1
+
H
2
+
3
+
4
+
```
1
5
/*
2
-
Given a n,m which means the row and column of the 2D matrix and an array of pair A( size k). Originally, the 2D matrix is all 0 which means there is only sea in the matrix. The list pair has k operator and each operator has two integer A[i].x, A[i].y means that you can change the grid matrix[A[i].x][A[i].y] from sea to island. Return how many island are there in the matrix after each operator.
6
+
Given a n,m which means the row and column of the 2D matrix and an array of pair A( size k).
7
+
Originally, the 2D matrix is all 0 which means there is only sea in the matrix.
8
+
The list pair has k operator and each operator has two integer A[i].x, A[i].y means
9
+
that you can change the grid matrix[A[i].x][A[i].y] from sea to island.
10
+
11
+
Return how many island are there in the matrix after each operator.
12
+
3
13
4
-
Have you met this question in a real interview? Yes
5
14
Example
6
15
Given n = 3, m = 3, array of pair A = [(0,0),(0,1),(2,2),(2,1)].
7
16
@@ -108,3 +117,5 @@ public List<Integer> numIslands2(int n, int m, Point[] operators) {
0 commit comments