Query on a matrix

Revision en1, by thedebater, 2020-03-22 20:58:18

We are given a matrix M of dimension N*N. All the cells are initially, zero. Also we are given Q queries, which contains 4 integers a b c d. where (a,b) is the TOP LEFT cell and (c,d) is the Bottom Right cell of a submatrix. Now, all the cells of This submatrix has to be incremented by one. After all the Q queries have been performed. Your task is to print the final resulting Matrix.

I know the 1-D version of this problem. But I'm having difficulties implementing it in 2-D form. Any inputs regarding the same?

Tags #matrix, #dynamic programing, #problem solving

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English thedebater 2020-03-22 20:58:18 545 Initial revision (published)