My 3 lines Python solution


  • 0
    S
    def searchInsert(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: int
        """
        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.