AnupamRoy's blog

By AnupamRoy, history, 3 years ago, In English

Since left side size 1 and right side size 0 . the result should be for value '1'. that's index is 2.
the problem link https://codeforces.com/problemset/problem/1199/A

the screenshot of result

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

»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Both indices are valid ,but the problem mentions choosing the earliest valid index. Why is the first index valid? Since y is 0 then nothing to care about to the right side of the chosen index. Since it's the first index so there are no elements to care about to the left side of the chosen index.