Javascript solution


  • 0
    I
    if (nums.includes(target))
            return nums.indexOf(target)
        for (let index = 0; index < nums.length; index++) {
            if (nums[index] > target)
                return index
        }
        return nums.length
    

Log in to reply
 

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