educative.io

Incorrect solution given for Maximum Sum Subarray of Size K (easy)

Just a friendly heads up, neither the O(N) solution nor the O(N*K) solution works in a case where all the values are negative.

Hi @Brett,

Thanks for reaching out. The problem statement says that we are expecting only positive numbers in the input array:

Given an array of positive numbers and a positive number ‘k’, find the maximum sum of any subarray of size ‘k’ .

Hope this clarifies your question.