0
Free MOCK
Apply Internship
Blog
Learning
Roadmap
Others
Login
Intermediate
JavaScript
Implement binary search
Implement a binary search algorithm on a sorted array.
Examples
Input:
binarySearch([1, 3, 5, 7, 9], 5)
Output:
2
Your Solution
Show Solution
Reset
Output
Run Code
Click 'Run Code' to see the output