Binary Search Implementation
Easy📝 Description
Implement binary search to find target in sorted array
Input Format
[a1, a2, ..., an] (sorted array), target
Output Format
index or -1 if not found
Constraints
1 ≤ n ≤ 10^4, -10^4 ≤ ai ≤ 10^4
🔍 Sample Input
[-1,0,3,5,9,12], 9
✅ Sample Output
4
Code Editor
Please login to run and submit code.
Results
Suggested Solution
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run