Please tell me what should I do for optimizing my code Its giving TLE

Tilling 2 -

C++ code - >

##int tilling(int row, int col){
if (row == 0){
return 1;
}
if (row <= col - 1){
return 1;
}
if (row < 0){
return 0;
}
return tilling(row - 1, col) + tilling(row - col, col);
}
##int main() {
int t;
cin >> t;
while(t–){
int r, c;
cin >> r >> c;
if (r == c){
cout << 2 << “\n”;
}else if (c == 1) cout << r << “\n”;
else cout << tilling(r, c) << “\n”;
}
}

hello @niffoisme

use dynamic programming to optimise it furthur

try this after completing 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.