educative.io

Solution or input/explanation?

The problem never states that the sub-array should be of consecutive numbers.
So for example, in the input :[2, 1, 5, 1, 3, 2], k=3

why wouldn’t [2,5,3] be a sub-array?

Hi @Joseph,

Thanks for posting your question.

Generally a subarray is defined as a contagious set of elements of an array , e.g., take a look here: https://www.hackerrank.com/challenges/java-negative-subarray/problem

But it looks like there is some confusion and people do refer it as ‘contiguous subarray’ when they mean to say ‘contiguous set of elements’. We’ve updated the problem definition to reflect this. Thanks for pointing this out.