I tried running for all output
and it works fine but why one test case is not passing
Please help this is a simple program
8
-56
0
45
50
57
68
98
207
1
Wrong Output for this Input
Please Check your code once again.
Mark the doubt as resolved if you dont have further queries.
yes I
added
if(found>=0)
System.out.println(found);
else
System.out.println(-1);
and it worked can you please tell me why
becuase Arrays.binarysearch(arr,search) return -1 when element not found
so why didn’t it print -1
Hi Arvind,here try to write your own binary search.
because no one knows internal implementation of Binary Search already present in Java.