Given a sorted array and a number key, return whether the key is present in the array or not.
Expected Time Complexity: O(log n)
Array: [1, 2, 3, 3, 3, 4, 4, 5]
Number: 2
Answer: true
Array: [1, 2, 3, 3, 3, 4, 4, 5]
Number: 6
Answer: false
First-line contains an integer âTâ denoting the number of test cases.
For each test case the input has two lines:
T lines each contain true or false denoting the answer for each test case.
2
8 2
1 2 3 3 3 4 4 5
8 6
1 2 3 3 3 4 4 5
true
false
1 <= T <= 100
1 <= n <= 104
-106 <= Ai <= 106
-106 <= key <= 106