For this Question: You are given an integer array cost where cost[i] is the cost of ith step on a staircase. Once you pay the cost, you can either climb one or two steps. You can either start from the step with index 0, or the step with index 1.
Return the minimum cost to reach the top of the floor.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>minCostClimbingStairs()</b> that takes the array cost as a parameter.

<b>Constarints</b>
2 &le; cost.length &le; 1000
0 &le; cost[i] &le; 999Return the minimum cost to reach the top of the floor.Sample Input:
3
10 15 20

Sample output:
15

<b>Explanation</b>
You will start at index 1.
- Pay 15 and climb two steps to reach the top.
The total cost is 15., I have written this Solution Code: class Solution {
    public int minCostClimbingStairs(int[] cost) {
        int n=cost.length;
        if (n==0)
            return 0;
        if(n==1)
            return cost[1];
        int[] minCost=new int[n];
        minCost[0]=cost[0];
        minCost[1]=cost[1];
        for(int i=2;i<n;i++)
        {
            minCost[i]=Math.min(minCost[i-1]+cost[i],minCost[i-2]+cost[i]);
        }
        return Math.min(minCost[n-1],minCost[n-2]);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?