Untitled
Anonymous
java
01/22/2023 11:16 AM
316 B
13
Indexable
public static int countWaysToClimb(int n) {
if (n < 0) {
return 0;
} else if (n == 0) {
return 1;
} else {
return countWaysToClimb(n - 1) + countWaysToClimb(n - 2) + countWaysToClimb(n - 3);
}
}
Editor is loading...