My issue
the 2nd option must be right here, as we need to check a[0] also
My code
8214
Learning course: Arrays using C
Problem Link: CodeChef: Practical coding for everyone
the 2nd option must be right here, as we need to check a[0] also
8214
Learning course: Arrays using C
Problem Link: CodeChef: Practical coding for everyone
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 ?
@yaalini
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.