Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike

1 Answer

0 like 0 dislike
You are given a 2d matrix A of m rows and n colums and you have to generate a matrix B of same dimension but the elements must be a summation of all the previous elements upto now.


For example if A=[{1,2,3},{4,5,6}],
then B =[{1,3,6},{5,12,21}]
Explanation: A(0,0)=B(0,0)
B(0,1)=A(0,0)+A(0,1)
B(0,2)=A(0,0)+A(0,1)+A(0,2)
B(1,0)=A(0,0)+A(1,0)
B(1,1)=A(0,0)+A(0,1)+A(1,0)+A(1,1)
B(1,2)=A(0,0)+A(0,1)+A(0,2)+A(1,0)+A(1,1)+A(1,2)
by Expert (144,420 points)
...