CandidFlakes's blog

By CandidFlakes, history, 15 months ago, In English

Please look at this submission. I am getting out of bounds error on line number 42. I have checked my code multiple times and also made sure that the vector 'a' is accessed up to i=a.size()-2 only, so that a[i+1] doesn't go out of bound.

Please help me identify my mistake.

I will be thankful for any help!

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
15 months ago, # |
Rev. 2   Vote: I like it +7 Vote: I do not like it

Captain Obvious to rescue:

If a.size() == 1 then a.size() - 2 == numeric_limits<size_t>::max() - 1

P.S. In DM I got corrected, it just numeric_limits<size_>::max()