I think wrong answer is given for CARRAYMCQ1 problem, so pls check and correct me

My issue

the 2nd option must be right here, as we need to check a[0] also

My code


Learning course: Arrays using C
Problem Link: CodeChef: Practical coding for everyone

they have used 1 based indexing
so A[0] will give u run time error.

thanks for replying! Will you please explain why A[0] will give run time error and if so then how will we check the first element ?

they have used 1 based indexing it means what we usually have like 0,1,2,3 and so on will be shifted by 1 and become 1,2,3,4…
so for i=2 till N we will check a[i] and a[i-1]
there is no need to check the first element .
just dry run the condition u will get it.