Please explain why there is a need to subtract 1 in the following program when we have already defined our own comparator function and passed it as a parameter to the lower bound function. According to me the result should come without subtracting 1 but that is not happening.
Lower bound Algorithm
@priyam04 if you are taking the lower_bound the according to your comparator it will point to a number just larger then the current number then it points to a number greater then it so we need to subtract 1 from it
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.