Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 03 · DSA · Worked, and deeper · about 22 min to read

Play it as a journeyTutor comes with a plan

DP, the hard shapes: digits, games and speed-ups

The DP Table
The DP Table · Open board

Shows a table filled one cell at a time from cells already filled. This lesson changes what a cell remembers, who is moving, and how fast a cell is filled.

Before you start. Recursion & Dynamic Programming gave you the notebook idea: solve each small copy of a question once and write the answer down. DP, five more shapes taught you to write the state (one line saying what a notebook entry means) and the recurrence (the rule that fills an entry from earlier ones). Dynamic Programming, Worked (filling the table) showed knapsack as a grid.

Lesson 19 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • The problem: three questions that make a plain table too slow or too big
  • Counting digits: a state that stops at the bound (the tight flag)
  • Two players, one number: the score difference
  • Choose or skip: the subset-sum table
  • Sliding windows inside a table: the monotone queue
  • Speeding up a cut table: divide and conquer optimization
  • The ladder

Terms it explains: state, recurrence, tight, digit DP, score difference, minimax, downward, monotone queue, divide and conquer optimization, quadrangle inequality, Common mistakes, 15 ->", count_ones(10.

Lab

The same recursion runs three ways. Which one solves ways(3) fifty-five times, and which solves it once?

Stay on Ask again every time, press Show next step twenty times, and watch calls made in The bill so far.

Open The DP table

Review DSA