Maximum window sum
Your task
Given a stream of integers and a window size k, return the maximum sum of any contiguous window of exactly k elements. If k is not a positive integer or is larger than the stream length, return -1. The stream may contain negatives.
Examples
max_window_sum(stream: list[int], k: int) -> intExample 1
Input
max_window_sum([1, 2, 3, 4, 5], 2)Output
9