Tiling problem-II

https://hack.codingblocks.com/contests/c/537/1045
https://ide.codingblocks.com/s/41268

its passing only 1 test case, are base cases or rec cases wrong?

Your code does not handle all the cases.
It doesn’t work well when n>m.
eg try for n=4, m=2

Try to attempt it using recursion. You need to two recursive calls each time corresponding to placing the tile horizontally or vertically.

alright, thank you for the hint!

That’s alright
I hope you’ll be able to figure out the code yourself now.

Some test cases show TLE while others are passing.
https://ide.codingblocks.com/s/45141

Hey Akshay, your code is working for test cases in which values of n and m are small but for larger values your code is giving TLE. So, try to solve this problem using dynamic programming it will be solved in O(N) and you will not get TLE.