when we use the comapritor and we put money = 100
it should us 50 because we are subtracting 1 from it ; the it is showing us 100
Comparitor function in this problem
@Saumya123456789 due to the comparator function, it behaves like upper_bound() function, so it will give us the first number strictly greater than key. Therefore we have to subtract 1, to get the key.
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.