Skip to content

Commit

Permalink
solve/#189: swift 풀이
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-muuu committed Mar 13, 2024
1 parent 366594e commit 0ee6aa0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions AlgorithmReview/Programmers/LV1/추억 점수.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// 추억 점수.swift
// AlgorithmReview
//
// Created by 박소윤 on 2024/03/14.
//

import Foundation

func solution(_ name:[String], _ yearning:[Int], _ photo:[[String]]) -> [Int] {

var map = [String: Int]()
for (n,y) in zip(name, yearning) {
map[n] = y
}

var answer = [Int]()
for p in photo {
answer.append(p.reduce(0){ $0 + (map[$1] ?? 0) })
}

return answer
}

0 comments on commit 0ee6aa0

Please sign in to comment.