Skip to content
Back to libraryPart 3 · Graphs and dynamic programming

3.5Dynamic programming II

Before you start

It helps to have read 3.4 Dynamic programming I, 1.5 Sorting and 2.3 Binary search. Overall level: Upper intermediate.

Practice: Dynamic programming II

0 of 4 solved

About these problems

Apply, Connect, Reason and Stretch describe difficulty within this topic, not an official contest rating. Open any problem in any order; reading the chapter first is optional.

  1. 1One-use equipmentThere are n items; item i has weight wi and value vi. Choose each item at most once so that the total weight is at most W. Print the maximum total value. Choosing nothing is allowed.ApplyNot started
  2. 2Shared subsequenceYou are given two strings s and t. Find the length of a longest sequence of characters that appears in both strings in the same order, not necessarily consecutively.ConnectNot started
  3. 3Edit the identifierYou are given two strings s and t. Find the minimum number of operations needed to turn s into t. Each operation inserts one character, deletes one character, or replaces one character with another.ReasonNot started
  4. 4Assign the jobsThere are n workers and n jobs. Assign each worker exactly one job so that no two workers get the same job. Worker i doing job j costs cij. Print the minimum total cost.StretchNot started

Read the lesson