AlgoFrames

Walk the flowchart

Standard · Trace the algorithm · about 5 min

Can [1, 5, 11, 5] be split into two groups with equal sums? Walk the flowchart for this problem and answer each question before the step plays.

Example 1

Input:

{"name":"Split into two equal sums","goal":"yes-no","overlap":true,"remembers":"capacity","goalCue":"can it be done: yes or no","overlapCue":"the same sum is reached in many ways","stateCue":"the sum still needed"}

Output:

knapsack

Constraints

  • The trace uses the problem shown.

Learn the idea first: Recognizing DP and choosing the state, a visual lesson.

More Recognizing DP and choosing the state problems