Share my Python solution

  • 1
    class Solution:
        # @param A, a list of integers
        # @param target, an integer to be inserted
        # @return integer
        def searchInsert(self, A, target):
    		for i in range(len(A)):
    			if A[i]>=target:
    				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.