Given an integer array A of length N. Where Ai is the cost of stepping on the ith stair.Problem Constraints
From ith stair, you can go to i+1th or i+2th numbered stair.
Initially, you are at 1st stair find the minimum cost to reach Nth stair.
2 <= N <= 105Input Format
1 <= Ai <= 104
The first and only argument is an integer array A.Output Format
Return an integer.Example Input
A = [1, 2, 1, 3]
A = [1, 2, 3, 4]
1 -> 3 -> 4
1 -> 2 -> 4
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified.
Still have a question? Checkout Sample Codes for more details.