educative.io

Educative

Please check the logic

Condition to check sliding window size seems to be incorrect. Please correct me if I am wrong.
In the below line

if (windowEnd >= k - 1) { // check it here

Correct logic. Indexes start with a 0 so k-1 will be index 2 for k = 3 (item 1 will be at index 0, item 2 at index 1 and item 3 at index 2)