Code issue , , ,, , , ,, , , , , , , , , , , , , , , , , , ,

according to me my code is correct but it didn’t pass 2 test cases

hey @Nitin-Mishra-2380486738834604
you are doing wrong
try for this input :
5
3
5
6
9
78
3
correct output : 0
your code Gives -1
just a change
else if (arr[mid] > k) {
hi = mid - 1;
} else if (arr[mid] < k) {
li = mid +1;
}
instead of
else if (arr[mid] > k) {
li = mid + 1;
} else if (arr[mid] < k) {
hi = mid - 1;
}
correct code