Pick the fix
Which question needs a variable window rather than a fixed one?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Longest run of days whose spending stays within a budget
Right: the window size is the answer, so it must grow and shrink.
When the window's length is what you are solving for, it has to change as you scan.
Why not the others?
- B Highest total over any 7 consecutive days. The size is given, so a fixed window fits.
- C Every 3-letter stretch that rearranges to 'abc'. The size is the pattern length, so it is fixed.