can we use lower_bound instead of upper_bound? then there will be no need of checing if previous element is smaller than current element.
Doubt in code of video
Return iterator to lower bound
Returns an iterator pointing to the first element in the range [first,last) which does not compare less than val.
Return iterator to upper bound
Returns an iterator pointing to the first element in the range [first,last) which compares greater than val.
so these are 2 different things when u have no which are same as that passed in the upper_bound, lower_bound function
read about there stl
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.