Flvx's blog

By Flvx, history, 14 months ago, In English

This solution fails the second testcase and I don't understand why since the logic that I have used here seems to be fine. Any help would be appreciated.

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

»
14 months ago, # |
  Vote: I like it +5 Vote: I do not like it

I think it's because in your code arr[i-1] + mid doesn't need to be on the first try >= cnd it can be updated afterwards by (i + 1).

  • »
    »
    14 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    oh, yeah that makes sense. my bad Thanks :)