Place the tiles , Getting 2 WA , 2 RE

Just an edit i tried changing mp[2]=2 but still WA & RE

hello @aryan_007
image

take mod while performing addition
(a+b)%mod= (a%mod+b%b)%mod;

if still it shows runtime error, then use bottom up dp and use only two variables to store previous two states of dp( similar to fibonnaci)

Ya sir , it still shows run time error , but what is the problem with top down dp , is it because of call stack ??

i think they have restricted the memory limit for this problem thats why only solution with O(1) space complexity is getting passed.

1 Like

Yes sir , solved now But the compiler has some bugs , instead of showing MLE , it was showing TLE .

Btw Thankyou sir , Question got accepted !!