my 3 line Python solution


  • 0
    Z
    class Solution(object):
        def searchInsert(self, nums, target):
            nums.append(target)
            nums.sort()
            return nums.index(target)
    

Log in to reply
 

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