"""
First, see if target is larger then the largest or smaller then the smallest
If it is out of range, it is not in the `nums`.
Second, we use two pointers `l`, `r` to navigate our *binary search*.
For every iteration, we choose the index, middle between `l` and `r` as `p`.
If the value at `p` is larger than the target, we search the left-half by `r = p-1`.
If the value at `p` is smaller than the target, we search the right-half by `l = p+1`.
Continue this proccess, until we find the value.
If we can't find the value, then `l` and `r` are going to collapse. `return -1`
Another solution is to use [bisect](https://docs.python.org/2.7/library/bisect.html).
"""
class Solution(object):
def search(self, nums, target):
if nums is None or len(nums)==0: return -1
if target