easySliding Window Pattern
Maximum Sum Subarray of Size K
Given an array of integers and a number `k`, find the maximum sum of any contiguous subarray of size `k`.
Examples
Input:
arr = [2, 1, 5, 1, 3, 2], k = 3Output:
9Explanation: Subarray [5, 1, 3] has maximum sum of 9.
Input:
arr = [2, 3, 4, 1, 5], k = 2Output:
7Explanation: Subarray [3, 4] has maximum sum of 7.
Hints (0/3)
Try to solve it first! Click "Reveal Next Hint" if you get stuck.
Your Code:
Results:
Output
Click "Run" to execute your code