Quiz on Sliding window Technique for DSA: Question 4

Last Updated :
Discuss
Comments

You are given the following array arr = [1, 2, 3, 4, 5, 6] and the window size k = 3. Initially, the start = 0 and end = 2 (the window includes elements from index 0 to 2). After processing this window, what is the next action taken by the sliding window algorithm?

Add the element at index 3 to the window and remove the element at index 0

Add the element at index 4 to the window and remove the element at index 1

Add the element at index 4 to the window and keep the element at index 2

Add the element at index 3 to the window and keep the element at index 0

Tags:
Share your thoughts in the comments