Starter 20 3rd question div 3

I am attaching starters 20 Stable Sequence solution . I don’t know why my solution is wrong even i applied the same algorithm as what was told in editorial

https://www.codechef.com/viewsolution/55256044

Please help !!

Try this TC:

5
1 0 2 5 5

Expected Output:

1

Your Output:

2

Try changing this line:

        for(i=0;i<n;i++){
	        if(a[maxi]<a[i]){       // change the line to a[maxi]<=a[i]
	            maxi=i;
	        }
	    }