retagged by
3,269 views

2 Answers

6 votes
6 votes
O(1)  since the array is sorted we have to find the sum of first two elements only if their sum is less than 1000 than output will be yes if not than since the elements are sorted if the sum of first two elements is not less than 1000 than the sum of no two elements would be less than 1000 and output would be no.
0 votes
0 votes
o(n)

Related questions

8 votes
8 votes
2 answers
1
0 votes
0 votes
2 answers
3
dhruba asked Jun 5, 2023
1,150 views
Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m < n). ...
1 votes
1 votes
2 answers
4