You are given an integer array cost where cost[i] is the cost of i-th step on a staircase. Once you pay the cost, you can climb one or two steps. You can start from index 0 or 1. Return the minimum cost to reach the top.
Examples
Input:cost = [10, 15, 20]
Output:15
Start at index 1, pay 15, and climb two steps to reach the top.
Input:cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1]
Output:6
Take the path: 0 -> 2 -> 4 -> 6 -> 7 -> 9 for total cost 6.