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!