Getting Wrong answer in 1 test case

I am not able to understand how the answer to the test case

5

30
40
35
45
42

is
1 2 1 4 1 END

and not

1 2 1 2 1 END ?

the link of my code:

@sanjit_15 I think you wrong interpreted the question
you have to find for how long duration that largest price come again.
Let me tell you what are you finding here
draw a bar chart of this stock price with day
if you wanna know the span of 45 stand on it and look behind if you see any larger then that stock count all stock till then.
if that stock is largest till now then count it from zero
Just look at this image this is not representing of this example but i hope it will help
image

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.