All challenges
mediumsearching 10 XP per passing test
Binary Search
Problem
Given a sorted array of integers, find the index of a target value using binary search. The array is 0-indexed, meaning the first element is at index 0. If the target value is not found, return -1. The array contains distinct elements, and the target value is guaranteed to be in the array. The array size is between 1 and 1000 elements. The target value is an integer between -1000000 and 1000000.
(run your code to see output)
Advertisement