One-dimensional Dynamic Programming
129 / 170One-dimensional Dynamic ProgrammingLesson 5 of 11About 45 min
The state is an amount rather than a position, and every option is available at every step.
This is meant to find the largest number of pieces that sum to exactly the target, reusing sizes freely. It reports that almost every target is impossible. Click the line that is wrong.
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.