📚 Problem
x만큼 간격이 있는 n개의 숫자
💫 Solve
func solution(_ x:Int, _ n:Int) -> [Int64] {
var arr : [Int64] = []
for i in 1...n {
arr.append(Int64(x*i))
}
return arr
}
🩺 Another Solution
func solution(_ x:Int, _ n:Int) -> [Int64] {
return Array(1...n).map { Int64($0 * x) }
}