Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Problem Submissions Solution

Find Element in a Sorted Array

Difficulty: Easy

Acceptance: 80.00%

Points: 20.00

Given a sorted array of integers and a target value, return the index of the target element if it is present in the array. If the target is not found, return -1. The array is sorted in non-decreasing order, and the search should be performed efficiently using binary search.

Topics

Companies

Articles

Examples:

N/A

Constraints:
  • 1 = arr.length = 105
  • -104 = arr[i], target = 104
  • arr is sorted in non-decreasing order.
Companies:
Apple
Topics:
Binary Search
Locked Content
Access Restricted: Please Login to access the code editor and test cases.