Plaese tell me error in this code,its not running efficiently.
At dry run,its giving correct result but only one test case is passing
Plaese tell me error in this code
hello @KetanPandey
consider this example
2 4 6
here lower bound and upper bound of 3 is 4 . clearly 3 is not there in the array but lower and upper bound 3 is defined.
In this problem u need to find lower and upper bound only when that element is present otherwise print -1.
to check whether element is there or not in array u can use binary search.