Medium20 min
Binary Search
Find extra in the sorted array value. Return its index, or -1 when it is absent.
Your function
Implement solve(value, extra) in JavaScript. Return the answer; printing alone does not count as a result.
Examples
Input:
[[1,3,5,7],5]Output:
2Input:
[[1,3,5],4]Output:
-1Constraints
Input contains at most 1,000 values or characters. Numbers are finite integers. Inputs follow the structure shown in the examples.