프로그래머스 - 가장 많이 받은 선물
·
Algorithm/programmers
import Foundationfunc solution(_ friends:[String], _ gifts:[String]) -> Int { var friendInfo: [String:Int] = [:] for (index, name) in friends.enumerated() { friendInfo[name] = index } var giftState: [[Int]] = .init(repeating: .init(repeating: 0, count: friends.count), count: friends.count) var giftCount: [Int] = .init(repeating: 0, count: friends.count) for g..