when i am using compare function in lower_bound it is working as upper_bound but as I defined a<=b it should return the nearest smaller value then my key but it is showing upper value why is that happening
code- https://ide.codingblocks.com/s/229438
Compare function showing the result of upper bound
but i really dont get it how compare function is working I tried to watch money change problem 2-3 times but using compare function in binary stl is still confusing
even after removing = how is it giving me exact position of element I am searching
we have removed = so it should not return exact index it should return lower index so why it is returning the same index i am finding
Lowerbound is issd to return greater or equal to the current element always.
we are using compare function to change that only my main doubt is why in the coin problem sir is using -1 in the code when finding lower bound
To find the previous lower element that current element
Is there any option i can discuss this problem over a call
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.