Wise. Energy analyzes consecutive energy readings to identify the highest-consumption period of a fixed duration. Given an integer array and a window size k, return the maximum sum of any contiguous subarray containing exactly k elements.
Implement max_window_sum(nums, k).
nums, a non-empty list of integers representing energy readings, and k, an integer window size.k.1 <= k <= len(nums).The window must contain exactly k consecutive readings. Do not sort or rearrange the input.
def max_window_sum(nums, k):