Array traversal

We will traverse the whole array once right?
Here in the eg we got a sum>k only at the last element.

Suppose we get a sum greater than k be4 the end of array
then -
first we will deque elements from front . once we stop deque- ing , we will again start inserting at rear . right?

hello @vishakha_narang

yeah something similar,pls watch the complete video both explanantion and code is covered in it

We will traverse the whole array once right? Here in the eg we got a sum>k only at the last element. Suppose we get a sum greater than k be4 the end of array then - first we will deque elements from front . once we stop deque- ing , we will again start inserting at rear . right?

i already replied …

As I mentioned before in the video we get a greater sum at the last element . My doubt is what if we get a sum greater than k be4 last element

yeah we will do this … incase the sum is found to be greater than required.

we have handled this case as well in the code shown in video

I code in Java so I don’t understand CPP syntax .

Thanks for clearing my doubt

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.