Problem 746 · Easy
dp[i] = min(dp[i-1] + cost[i-1], dp[i-2] + cost[i-2]); answer is min(dp[n-1], dp[n]).
Open the interactive visualisation