Two-dimensional Dynamic Programming
137 / 170Two-dimensional Dynamic ProgrammingLesson 2 of 11About 47 min
The most reusable two-dimensional state in the course: how much of each input has been consumed.
Build the shared-sequence table for a = "abc" and b = "ac". Table index i means the first i characters of a, and j means the first j of b. Fill in the row for i = 3, that is the whole of abc.
| cell | value |
|---|---|
| i=3, j=0 | |
| i=3, j=1 | |
| i=3, j=2 |
Read the constraints first and let them tell you what complexity is expected. Derive the approach, implement it, run the tests, and submit when it passes.