Optimise by finding the wasted work

How to Think · DSA: How to Think · Advanced · 20 min

Go from brute force to optimal with one question, "what am I recomputing?", and five standard fixes, each shown as before-and-after code.

This lesson is part of TuringPath Pro. See plans.

More in DSA: How to Think

Previous: Spot the pattern from the signals · Next: Edge cases, dry runs and testing