프로그래머스 - 로또의 최고 순위와 최저 순위
·
Algorithm/programmers
import Foundationfunc solution(_ lottos:[Int], _ win_nums:[Int]) -> [Int] { let rank = [6,5,4,3,2] let lottoSet: Set = Set(lottos) let win_numSet: Set = Set(win_nums) let inter = lottoSet.intersection(win_numSet) var first = inter.count + lottos.filter { $0 == 0 }.count first = (first >= 2) ? rank.firstIndex(of: first)!+1 : 6 var last = inter.count last = (last >= 2) ? (r..