Questions about the best contiguous range, like the maximum sum of k consecutive days, tempt you to recompute every range from scratch. A sliding window updates the answer as one element enters and one leaves, so the whole scan is O(n). Use it for subarrays or substrings that must be contiguous, such as the longest substring without repeating characters. If the elements need not be next to each other, it is a subsequence problem and usually needs DP instead.