I did not understand why the additional if condition is used. We have already used upper bound funtion.
Doubt in the concept
Hey @vageesha suppose you have to find upper_bound of number x. And there is no number bigger then x. Then there’s no need of checking if arr(i) is greater than dp(pos-1).
You can handle this x element as the last element of your dp sequence.
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.