Skip to content

Commit fb51308

Browse files
authored
Update climbing-stairs.cpp
1 parent 7732790 commit fb51308

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/climbing-stairs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Solution {
66
int climbStairs(int n) {
77
vector<vector<int>> T = {{1, 1},
88
{1, 0}};
9-
return matrixMult({{1, 1}}, matrixExpo(T, n - 1))[0][0]; // [a1, a0] * T^(n-1)
9+
return matrixMult({{1, 0}}, matrixExpo(T, n))[0][0]; // [a0, a(-1)] * T^n
1010
}
1111

1212
private:

0 commit comments

Comments
 (0)