Each step i has a cost cost[i] you pay when you step on it. You can start on step 0 or 1 and climb 1 or 2 steps at a time; the top is just past the last step. Return the minimum total cost to reach the top, in O(n) time and O(1) space.
Also implement ways(n, steps): the number of distinct ways to climb exactly n stairs when each move can be any size in the list steps.