Binary search is a famous question in algorithm.
For a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity.
If the target number does not exist in the array, return -1.
样例
If the array is [1, 2, 3, 3, 4, 5, 10], for given target 3, return 2.
挑战
If the count of numbers is bigger than MAXINT, can your code work properly?
class Solution {
/**
* @param nums: The integer array.
* @param target: T......
阅读全文