Python easy understand solution 39s


  • 0
    W

    '''

    class Solution(object):

    def searchInsert(self, nums, target):
    
        for i, num in enumerate(nums):
            if num == target:
                return i
            if target <= num:
                return i
            
        return i+1
    

    '''


Log in to reply
 

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