<filename>BinarySearch.py
class Solution(object):
    def search(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: int
        """
        if nums is None or target is None:
            return -1
        nums.sort()
        left = 0
        right = len(nums) - 1
        while(right >= left):
            mid = (right + left) // 2
            if target == nums[mid]:
                return mid
            elif target > nums[mid]:
                left = mid + 1
            elif target < nums[mid]:
                right = mid - 1
        return -1
                
        

<filename>BinarySearch.py
class Solution(object):
    def search(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: int
        """
        if nums is None or target is None:
            return -1
        nums.sort()
        left = 0
        right = len(nums) - 1
        while(right >= left):
            mid = (right + left) // 2
            if target == nums[mid]:
                return mid
            elif target > nums[mid]:
                left = mid + 1
            elif target < nums[mid]:
                right = mid - 1
        return -1
                
        

:type nums: List[int]         :type target: int         :rtype: int