Code AnalysisIntermediate 45s
Trace: DP Table
For climbing stairs with n=4, the DP table is: dp[0]=1, dp[1]=1, dp[2]=2, dp[3]=3, dp[4]=?
dp[i] = dp[i-1] + dp[i-2]
Starter code
// dp[0]=1, dp[1]=1 // dp[2]=dp[1]+dp[0]=2 // dp[3]=dp[2]+dp[1]=3 // dp[4]=dp[3]+dp[2]=5
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.