Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 45s1 days 16 hours 1 minutes 45 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 45s1 days 16 hours 1 minutes 45 seconds.

Sign in to watch this lesson
Algorithms - Dynamic Programming · 4:06
Give the Fibonacci recurrence real choices and the classic one-dimensional DPs appear: ways to climb stairs with strides of 1, 2 or 3 (274 ways to the tenth step), the fewest coins from {1, 5, 6, 9} to pay 11 (5 + 6, where greedy's 9 + 1 + 1 needs three), and counting payments, where putting coins in the outer loop counts 6 sets while putting amounts outside counts 22 ordered sequences. We finish with the take-or-skip house robber (18 from 5 1 3 9 2 4, beating both alternating picks) and its trading cousin, weighted interval scheduling.