Python 42ms - easy to understand

  • 0
    class Solution(object):
        def searchInsert(self, nums, target):
            i = 0
            while i < len(nums) and target > nums[i]:
                i += 1
            return i
            :type nums: List[int]
            :type target: int
            :rtype: int

Log in to reply

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