Cant understand the base case

I solved the rec case but cannot figure out the base case

hello @king-slayer97

if n < m then we will have only one way of arraning the tiles.

so put if(n<m) return 1; as one of ur base case

getting TLE Code: https://ide.codingblocks.com/s/443895

@king-slayer97

your solution has exponential time complexity thats why it is giving tle.

use dynamic programming to optimise it.

I converted it into dp but there is a run time error. CODE:https://ide.codingblocks.com/s/444353

becuase of dp array size it is giving run error.
why r u considering m as ur dp state, it is always constant.

use 1dp where dp[i]= ways of arranging i X M matrix.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.