Skip to content

[Algorithm] x만큼 간격이 있는 n개의 숫자 #79

Description

@hwangJi-dev

💬 문제

[코딩테스트 연습 - x만큼 간격이 있는 n개의 숫자](https://school.programmers.co.kr/learn/courses/30/lessons/12954)


💬 풀이

func solution(_ x:Int, _ n:Int)->[Int64]{varresult:[Int64]=[]foriin1...n {
result.append(Int64(x * i))}return result
}

💬 더 나은 방법?

func solution(_ x:Int, _ n:Int)->[Int64]{returnArray(1...n).map{Int64($0 * x)}}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions