getting Runtime error in two test cases. please help!
problem link: https://hack.codingblocks.com/contests/c/526/739
my code link: https://paste.ee/p/Fl1jg
Place the tiles
- your base case should be n<2 return 1;
- n 's range is 10^8 and you can’t create such large array locally .So try using global array.
- Recurrence/ top down dp can only be used if n is small because recursion stack can have a maximum of 10^8 entries. Try using bottom up dp.
HInt: Fibonnaci recuurence relation.
Here is my solution for your reference:
https://ide.codingblocks.com/s/44565
top down wont work here check top down for small cases u will see a pattern find that and then simply maths u will solve it reply for code