Tiling problem - 2 problem

I’m getting Time limit in most cases. Do i have to use DP?

@aiman.mumtaz Yes you have to use DP in this question to pass all the test cases since constraints are large.

If want any help regarding it you can ask otherwise please mark this doubt as resolved.

Yes. How do I do it using DP

@aiman.mumtaz you can use Memoization(i.e. Top Down DP) by making a dp array of something like dp[n].

still getting TLE https://ide.codingblocks.com/s/247784

Your code is giving wrong answer.
Check this simple bottom us dp approach: