Upper bound of a number

e.g - 10, 20, 30, 5, 1, 90

upper_bound(5) is ?

to use upper bound array must be sorted
1,5,10,20,30,90
hence answer should be 2 nd index(element = 10)

more Examples

Input : 10 20 30 30 40 50
Output : upper_bound for element 30 is at index 4

Input : 10 20 30 40 50
Output : upper_bound for element 45 is at index 4

Input : 10 20 30 40 50
Output : upper_bound for element 60 is at index 5

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.