Skip to content

[Algorithm] 부족한 금액 계산하기 #84

@hwangJi-dev

Description

@hwangJi-dev

💬 문제

[코딩테스트 연습 - 부족한 금액 계산하기](https://school.programmers.co.kr/learn/courses/30/lessons/82612)


💬 풀이

func solution(price:Int, money:Int, count:Int) -> Int64 {
    let p = Int64((1...count).map({ $0 * price }).reduce(0, +))
    return Int64(money) > p ? 0 : p - Int64(money)
}

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions