Tilling problem 2


its showing run error can u plz mark where is the error ??

hello @Ashu1318
a) u r declaring dp array in each function call which is wrong.

follow this->
a) declare ur dp array as global and intiialise it inside ur while loop of main function.

its working but what’s the diff if we declare inside function not globally

u r following top down dp, where we need to preserve result for later use right?
but because u r declaring new array evertime , no data is getting preserved and thats why it is not workin

okay okay got it thanks