One test case is not passed

Kindly tell me the error in my code
Code is :

Hello @Ramitgoel,

Let’s understand it with the help of a test case:
5
39
45
40
42
43
Expected Output:
1 2 1 2 3 END
Your Output:
1 2 1 1 2 END
Explanation:
40<45
So, the value at current index will be 1.
42 > 40
So, value at current index should be 1(value at previous index)+1=2
Similarly 43>42
So, value at current index should be 2(value at previous index)+1=3

Hope, this would help.
Give a like if you are satisfied.

1 Like