Algorithm
프로그래머스 캐시 [Swift]
https://programmers.co.kr/learn/courses/30/lessons/17680?language=swift Int { var cities = cities.map({$0.uppercased()}) var caches = [String]() var answer = 0 for city in cities { if caches.contains(city) { answer += 1 } else { answer += 5 } if caches.count >= cacheSize { if cacheSize != 0 { // cacheSize가 0이면 removeFirst()에서 error if caches.contains(city) { for (i, e) in caches.enumerated() { i..
2021. 11. 17. 17:47
최근댓글