Tle with recursion

Although the problem is for recursion, i have been solving some of these using DP, by taking an array and applying the recurrence relations, is it alright??? i know i can also use matrix exponentiation but i am in no mood to code it right now , considering the constraints are not large enough for it .

@debyian
Hello divyansh,
it is ok to solve this problem using dp.

1 Like

@debyian
pls don’t forget to mark it as resolved