Rahul1998's blog

By Rahul1998, history, 5 weeks ago, In English

This is the question link :- (https://codeforces.com/contest/1513/problem/A) In this problem statement , I am confused that the index variable 'i' is starting from 0 or 1 ?? Down below , I am adding that part of problem where I have issue .

Note In the second test case of the example, we have array a=[2,4,1,5,3]. Here, indices i=2 and i=4 are the peaks of the array. This is because (a2>a1, a2>a3) and (a4>a3, a4>a5).

here , a2 is representing 3rd element or second element and a1 is representing 1st or 2nd element ??

 
 
 
 
  • Vote: I like it
  • -5
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it +10 Vote: I do not like it

a2 is representing 2nd element and a1 is representing 1st element (1-based indexing).