solution for swift


  • 0
    L

    func searchInsert(_ nums: [Int], _ target: Int) -> Int {
    var index = 0
    for num in nums {
    if num == target || num > target {
    return index
    }
    index += 1
    }
    return index
    }


Log in to reply
 

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