I'll define dp[i] as the minimum cost to reach position i. Your state must contain all information needed to solve the subproblem.
This captures the minimum cost to reach position . From there, extend to the end.
Base cases: dp[0] = cost[0] and dp[1] = cost[1] (start at either for free, but pay when leaving). For i >= 2, you arrive from i-1 or i-2. Take the minimum: dp[i] = min(dp[i-1], dp[i-2]) + cost[i].