plz explain to me how the output is coming/
Leet code dp codes
hello @Somasree
u need to replace each coordinate (i,j) with sum of element (r,c)
where r varies from i-k … i+k , c varies from j-k …j+k
example->
[[1,2,3],
[4,5,6],
[7,8,9]]
k=1
consider (0,0) coordinate .
here r will vary from [ 0-1…0+1] -> [-1…1] ignore negative index
r-> [0…1]
similary c [0-1,0+1] => [-1…1] -> [0…1]
resultant value at (0,0)-> value (0,0) + value(0,1) + value(1,0) + value(1,1)
which is 12.
similary for other coordintates
ok understood thank u
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.