Untitled

mail@pastecode.io avatar
unknown
java
a year ago
235 B
1
Indexable
Never
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);
    }
}