Skip to content

Commit

Permalink
GO: 70. Climbing Stairs
Browse files Browse the repository at this point in the history
  • Loading branch information
MaratKhakim committed Aug 14, 2022
1 parent 955d72c commit dfbe250
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions go/70-Climbing-Stairs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
func climbStairs(n int) int {
one, two := 1, 1

for i := 0; i < n-1; i++ {
sum := one + two
one, two = two, sum
}

return two
}

0 comments on commit dfbe250

Please sign in to comment.