Quiz

Which Pattern?

Two pointers, sliding windows and prefix sums all replace nested loops, but each fits a different kind of question.

A ledger holds 100,000 daily totals. You must answer 50,000 questions like *"what was the total from day `a` to day `b`?"* with different `a` and `b` each time. Which approach is fastest overall?