Searching Algorithm in an Array

Asked In: AmazonMicrosoftAdobeWalmartLabs

You are given an integer array where the numbers are sorted. You need to find an element in this integer array efficiently in O(Log n) Time complexity and O(1) Space Complexity.


Input : [2, 3, 4, 5, 6, 7, 8, 9, 10]

Find integer 4 in an array
Output: 4

Constraint1 :Find integer value in O(log n) time complexity.

Hint : Think for using Binary Search

Problem level: Easy