💡 Tilling Problem - II

how do i overcome tle in this problem
my code

U are supposed to solve this question using Dynamic Programming since it is a scenario of overlapping subproblems