Mixed Practice removed the label from the problem. Both exercises turned out to need running totals and a Map, and the hard part was noticing that a sliding window wouldn’t do:
| Exercise | The question that unlocked it |
|---|---|
| Longest Stretch With Equal Wins and Losses | When has the running lead been exactly this value before, and when was the first time? |
| Shortest Stretch With an Exact Net Change | Which earlier running total equals my current total minus the target, and where did it last appear? |
A quick self-check: think of the test that stayed red the longest for you. Which assumption in your code did it break? Interviewers often ask exactly that kind of question, and it’s a lot easier to answer once you’ve talked it through.
Want a second pair of eyes on your Mixed Practice work?
If you haven’t taken the quiz yet, do it before the mock interview. It’s a fast way to practice naming the pattern from a problem description alone.