Tilling Problem

sir can you explain the base case of tilling problem

Hi sandeep
noofways(int n, int m) : gives no .of ways to place tile in space of nxml

  1. n<=0 return 0 // no way possible
  2. 1<=n<m return 1 // only 1 way to place horizontal
  3. n==m return 2 //only 2 ways possible either place all vertical or all horizontal
    else return noofways(n-1,m) + noofways(n-m,m) //recursion

Hope it helps
Mark resolved if satisfied :slight_smile: