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

Sign in to watch this lesson
Algorithms - Dynamic Programming · 3:54
When the DP state has two indices, the table becomes a grid: a cell of a maze, or a prefix of each of two strings. We count right/down paths (35 on an open 4 x 5 grid, 7 once two walls go in), fill the longest common subsequence of TRADE and TREAD, and turn kitten into sitting with three edits by colouring every cell with the neighbour that won its minimum and walking back. Finally we cut the memory from a 400 MB table to two rows, measured on this Mac, and see why the edit script still needs the full table.