Binary Search
Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.
Binary Search

Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.

Example 1:
Input: {"nums":[-1,0,3,5,9,12],"target":9}
Output: 4
Input
arr ={"nums":[-1,0,3,5,9,12],"target":9}
Target: 9

-1

L

0

3

5

9

12

R
Variables
No variables to display
DepthFunction Call
Stack empty
0/7