Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
1,825 views
in Online Assessments by Expert (108,190 points) | 1,825 views

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 (108,190 points)