본문 바로가기
코테/프로그래머스

[프로그래머스] x만큼 간격이 있는 n개의 숫자 스위프트

by 리드맥 2022. 2. 5.
func solution(_ x:Int, _ n:Int) -> [Int64] {
    
    var arr:[Int64] = []
    
    var result = 0
    for i in 1...n {
        result = result + x
        arr.append(Int64(result))
    }
    

    return arr
}

댓글