Not clear with the question

we are given floor of 2X3 means the length is 3 and the breadth is 2 and accordingly the size of tile will be 1X3 that is the length is 3 and the breadth is 3
So number of ways in which we can cover the whole floor by placing the tile will be to cover the breadth of the floor which is 2

@guptadev354,

A tile can be either place vertically,meaning it will only occupy a cell of width 1 and a complete height of M. Or, You can place M tiles horizontally one over the other if there is enough width left.

  1. The area that needs to be tilled is n x m.
  2. The tile has the dimension: 1 x m.
    …You can place tiles either horizontally or vertically:
    2.1. When placed horizontally i.e. 1 x m,
    … it will cover one entire row.
    2.2. When placed vertically i.e. m x 1,
    … it will cover one column and m rows of the area.
    So, you need m such vertical tiles to cover m columns and m rows.

import java.util.*; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while (t > 0) { int n = scn.nextInt(); int m = scn.nextInt(); int c = (int) (Math.pow(10, 9) + 7); System.out.println(tile(n, m, c) % c); t–; } } public static int tile(int n, int m, int c) { if (n >= 1 && n < m) { return 1; } if (n == m) { return 2; } if(n<0){ return 0; } return (tile(n - 2, m,c) % c + tile(n - 1, m,c) % c); } } “showing TLE”