Back to the Problem
dp[i] = min(dp[i−1] + |hi−hi−1|, dp[i−2] + |hi−hi−2|); two rolling variables suffice.
Complexity: O(N)