-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
💬 문제
[코딩테스트 연습 - x만큼 간격이 있는 n개의 숫자](https://school.programmers.co.kr/learn/courses/30/lessons/12954)
💬 풀이
func solution(_ x:Int, _ n:Int) -> [Int64] {
var result: [Int64] = []
for i in 1...n {
result.append(Int64(x * i))
}
return result
}
💬 더 나은 방법?
func solution(_ x:Int, _ n:Int) -> [Int64] {
return Array(1...n).map { Int64($0 * x) }
}