Simple Intuitive python solution


  • 0
    class Solution(object):
        def searchInsert(self, nums, target):        
            nums.sort()      
            if target in nums:
    	        return ((nums.index(target)))
            else:
                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.