https://leetcode.com/problems/search-insert-position/description/
class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if len(nums) == 0:
return 0
start = 0
end = len(nums)-1
while start<end:
half = (start+end)/2
if nums[half]<target:
start = half+1
else:
end = half-1
if nums[start] >= target:
return start
return start+1