#3693
Climbing Stairs II
specialist · 665 · lc medium +30 · 64% accepted · 79 likes · top 67%
Description
A staircase has n + 1 steps numbered 0 to n. A 1-indexed array costs gives the cost of each step. From step i you may jump to i+1, i+2, or i+3; the jump cost is costs[j] + (j - i)2. Starting at step 0 with cost 0, return the minimum total cost to reach step n.
Code
1
2
3