Given an m * n matrixMinitialized with all0's and several update operations. Operations are represented by a 2D array, and each operation is represented by an array with twopositiveintegersaandb, which meansM[i][j]should beadded by onefor all0 <= i <…