Run error in code

I am getting run error in 2 testcases. please check

Hey @Akshita99
You have to do this in O(n) memory
Hint: You are always using 2 rows at a time current roe and previous row.

so can i use an array of size sum+1?

no, it will not work. So dow i take an 2d array with 2 rows and each time update the values in 1st row?

ok i understood. its done

1 Like