First negative integer

what is K in this acse?

@tanishka972,
k is the size of the window.

Example:
We are the given the following array:
12 -1 -7 8 -15
and k is given to be 3.

Now you have to find the first negative number in each window of 3 elements.
This means that we have a sliding window size of 3 elements.

So our windows will be:

  1. (12 -1 -7) Output for this window will be -1
  2. (-1 -7 8) Output for this window will be -1
  3. (-7 8 -15) Output for this window will be -7
1 Like

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.

1 Like