cost[i] is the price to step off stair i; after paying you may climb 1 or 2 stairs. You may start on stair 0 or stair 1. The top is one step beyond the last stair. Return the minimum total cost to reach the top.
For [10, 15, 20] the answer is 15 (start on stair 1, pay 15, jump 2 to the top).
Example 1
Input:
min_cost_climbing([10, 15, 20])
Output:
15
Example 2
Input:
min_cost_climbing([1, 100, 1, 1, 1, 100, 1, 1, 100, 1])
Output:
6
0 <= len(cost) <= 10000000 <= cost[i] <= 999No results yet
Run your code to check it against the examples, or submit to run every test.