Back to course home
0% completed
Vote For New Content
Insufficient Test Case
Tecson Gacrama
Dec 26, 2025
This test case needs to be added:
arr = [1, 3, 5, 7, 9]
key = 4
otherwise this code passes:
class Solution:
def searchCeilingOfANumber(self, arr, key):
if not arr:
return -1
start = 0
end = len(arr)-1
while start <= end:
mid = start + (end-start) // 2
if arr[mid] == key:
return mid
elif arr[mid] < key:
start = mid + 1
else:
end = mid - 1
if arr[mid] > key:
return mid
return -1
0
0
Comments
Comments