Python 1-line binary search cheating!!!!!


  • 0
    F
    class Solution(object):
        def searchInsert(self, nums, target):
            """
            :type nums: List[int]
            :type target: int
            :rtype: int
            """
            import bisect
            return bisect.bisect_left(nums, target)
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.