Why do we need to subtract -1

why do we need to subtract -1 after passing the comparator and why is the output like this on changing the constructor to a>=b instead of a<=b. PLs help with the concept of constructor in this case .

@kunal81198 using comparator on lowerbound just make it behaves like upperbound that’s why -1

Bro can u tell me what does passing this :-
bool compare(int a ,int b){return a>=b;}
comparator function means vs
bool compare(int a ,int b){return a<=b;}
means

@kunal81198
in normal sorting a>b means sort in desc and a<b means sort by inc order
its simple in this case
but in case of lowerbound
comparator are not generally used ( not used once in lowerbound and all)
but still its just for knowledge
a<=b (in the video) just make lower bound behaves like upperbound
ex
1 2 3 4
key =2
lowerbound gives 2
but lowerbound with a<=b comp gives 3
so basically you can use upper bound thats why not used

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.