Lower bound and upper bound

Things i know:

  • Lower bound: first element that is greater-or-equal.
  • Upper bound: first element that is strictly greater.
    so i applied i got unexpected results can any one explain??
    link of : code
    can any one explain it in a clear manner??

For using Lower bound and Upper bound, the array should be sorted but the vector you are using doesn’t have elements in sorted order. Hence the wrong answer.

3 Likes

It is unexpected result because of your array is not sorted. For getting expected answer it should be sorted.

1 Like

Thank u i got it

yeah,Thanks