Solution by Howell

  • 0

    Loop throught the list once.

    class Solution(object):
        def searchInsert(self, nums, target):
            :type nums: List[int]
            :type target: int
            :rtype: int
            for i in range(len(nums)):
                if target <= nums[i]:
                    return i
            return len(nums)

Log in to reply

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