Kindly help getting WA (Wrong answer )

Not able to figure out my mistake . Kindly help with tiling problem 2.

hello @achin1tya
initialse ur dp array with zero while computing answer for each test cases.

HI , @aman212yadav , I used long dp[10000] = {0} in the initialisation . will it not work ?

no,u should again initialise it inside while loop.

yes , it worked . But why ? isnt {0} the same as initializing . Thx for the help

that will intialise only once after each iteration ur dp array will contain some values (non zero) which are of no use for new testcase.therefore again intialising it with 0.

1 Like