How can we do this question by recursion if bot n and m are from user input?

how can we do this question by recursion if bot n and m are from user input?

It can be done, there is no boundation that you cannot do those questions which require user input by recursion!!
just think this way: for any n, there are 3 possibilities:

  1. n>m - here you can place a tile vertically(left with n-m,m) as well as horizontally(left with n-1,m).
  2. n==m then there are always 2 ways - horizontally or vertically.
  3. n<m here you have only 1 choice,that is to place tile horizontally, so 1 way only.
    Also mere recursion won’t help in passing all test cases, you have to use DP.

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.