Question is not clear

Can you please tell how exactly the problem is working .

Hey @1999atrijsharma
In this problem you have figured the base cases correct that if n<m then return 1 and if n==m return 2. The recurrsion relation will be that if n>m then add the two recursions . One with same function but n as n-1 and the other will be same function but with n= n-m . Now this will the two cases one in which tile are placed vertically will be where n=n-1 and the one where tiles are placed horizontally will be where n=n-m . And also i will recommend that rather than forming a recurrence relation try to take a array of size n+1 and fill it from index i= 1 where size of n =1 till index i= n and where each index has the total possible way of that case on that index i. Recurrsion relation may give you time error

Maa’m Can you please tell me whether my approch is right with recurssion and if Yes then is it a DP based question??

maam can you please tell me whether it is DP question ??

hey @1999atrijsharma
sorry for the late reply. You are correct ,try it with dp

ma’am can you please see my code as i have applied DP in it but still it is showing run error .

use modulo
here is your corrected code: