https://www.codechef.com/viewsolution/37381159
what is the problem with the code?
Codechef contest problem
The condition is incorrect, you need to maintain a global minima as you go from left to right.
and do
if(arr[i]<=minima) minima = arr[i], count++;
instead of
if(arr[i]>arr[i+1]) cnt++;
You haven’t sent you code link, this is the wrong link
Change line 26 to
for(int i=1;i<n;i++)
thanks a lot.It works.
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.