Documentation
¶
Overview ¶
https://leetcode.com/problems/climbing-stairs/#/description
ou are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
Note: Given n will be a positive integer.
假设梯子有n层,那么如何爬到第n层呢,因为每次只能爬1或2步,那么爬到第n层的方法要么是从第n-1层一步上来的,要不就是从n-2层2步上来的,所以递推公式非常容易的就得出了: dp[n] = dp[n-1] + dp[n-2] (上第n层只有两种解法) 如果梯子有1层或者2层,dp[1] = 1, dp[2] = 2,如果梯子有0层,自然dp[0] = 0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NumArray ¶
type NumArray struct {
// contains filtered or unexported fields
}
func Constructor ¶
type NumMatrix ¶
type NumMatrix struct {
// contains filtered or unexported fields
}
func NumMatrixConstructor ¶
Source Files
¶
- NumArray.go
- NumMatrix.SumRegion.go
- calculateMinimumHP.go
- canCross.go
- climbStairs.go
- coinChange.go
- divisorGame.go
- generateTrees.go
- isInterleave.go
- isMatch.go
- isMatch2.go
- isScramble.go
- isSubsequence.go
- lengthOfLIS.go
- maxProduct.go
- maxProfit.go
- maxProfit2.go
- maxProfit3.go
- maxProfit4.go
- maximalRectangle.go
- maximalSquare.go
- minCostClimbingStairs.go
- minCut.go
- minDistance.go
- minPathSum.go
- minimumTotal.go
- numDecodings.go
- numDistinct.go
- numTrees.go
- rob.go
- rob2.go
- uniquePaths.go
- uniquePathsWithObstacles.go
- wordBreak.go
Click to show internal directories.
Click to hide internal directories.