Sir, i am not able to understand the question please explain it.
Doubt in "Find upper and lower bound"
@76rahul257 The question is simple. For a given sorted array of n elements, you have to find the lower and upper bound positions of T test case elements.If the element is not present in the array, you have to print -1.
This is an application of Binary search as you have learnt in the video lectures of the course.
Consider the sample case:
5 <=== n, number of elements in the array
1 2 3 3 4 <==== the array
3 <====no of test cases/search elements
2
3
10
Expected Output:
1 1 ===> since 2 is present at index 1. its lower and upper bound both is 1.
2 3 ===>since 3 is present at index 2 and 3. So its lower bound is 2 and upper bound is 3.
-1 -1===> since 10 is not present, so lower and upper bound is -1.
Hope this helps.
Hit like if you understood the question.
Thanks for giving your time.
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.