MY CODE : https://ide.codingblocks.com/s/211645
not giving the correct value of ‘it’.
it should give 100.
in line 17 why are we using -1 at the end. comparator here returns no<=money.
so, it should have returned index of 100. why -1?
MY CODE : https://ide.codingblocks.com/s/211645
not giving the correct value of ‘it’.
it should give 100.
in line 17 why are we using -1 at the end. comparator here returns no<=money.
so, it should have returned index of 100. why -1?
You need to write a<b in your comparator function.
Hope it Helps.
It doesn’t work. isuue persists
output should have been 6, 100 na?
That is why -1 is done in the video. Hope your this doubt is also cleared.
why didn’t he use upper_bound then?
why did he write an extra comparator function if he was supposed to get same answer?
i’m really confused. 
@prateek_5 hi ,sir ne bs hme comparator function bnana bta rhe the ,ki hm lower bound ko kaise change kr skte hai ,don’t worry apka logic sahi hai.
mera sawal ye hai ki , jab comparator <= hoga to 100<168 hona chahiye tha but ye 200 return karta hai aur phir hume -1 karna padta hai 100 laane ke liye .
aisa kyun??
yahan lower_bound function me comparator kya kaam kar raha hai?
@prateek_5 bhai agr ap comparator use kroge to -1 mt lgana agr comparator nhi bna rhe then use that.
Comparator is checking each value with the given money value in ascending order.
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.