LOWER BOUND FUNCTION

If we have already added compare function in lower bound then what is the need of adding -1 ?
When we are entering 168 why is it giving 200,
It should give 100 since 100 <= 168

@mverma_be19
this is not how custom compare works.
default comparator for stl lower bound returns a<b it means it rejects the value which are less than searched value and hence will give you index of the value greater than or equal to searched value.
so default lower bound will give 100 as answer of 100 and 200 as answer of 168 but we need 100 as answer of both 100 and 168 so for this we made custom compare function (return a<=b) which rejects the value less than or equal to searched value and will give you the index of next greater than the searched value in this way we will get 200 as answer for 100 as well as for 168 and subtracting 1 from this will give us the correct answer which is 100 for this.

or you can simply say that by using custom compare we have made lower bound to work as upper bound.