Tiling problem2

all the cases are giving time limit error…cant understand the logic

You have to solve this question using a dynamic programming approach because it consists of overlapping subproblems