Number Of Island 2
Given an m*n matrix mat, 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 mat[A[i].x][A[i].y] from sea to island. Return how many island are there in the matrix after each operator.You need to return an array of size K.
1<= m,n <= 10000 1<= k <= 10^6
First line contains three integers m and n and k. Each of next k lines contain 2 numbers denoting row and col to change into 1.
print number of island after each operation.
3 3 4 0 0 0 1 1 2 2 1
[1, 1, 2, 3]