Solution in Ruby


  • 0
    H

    def search_insert(nums, target)

     for n in 0...nums.length 
        if nums[n]==target || nums[n] > target
            return n
        end
      end
        return nums.length
     end

Log in to reply
 

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