programmers.co.kr/learn/courses/30/lessons/67256?language=swift 나의 풀이 import Foundation func solution(_ numbers:[Int], _ hand:String) -> String { var hands: [String] = [] var changedNum: [Int] = numbers // 처음 손의 좌표 var leftRight: [[Int]] = [[3,0], [3,2]] for i in 0.. distance(a: leftRight[1], b: point) { hands.append("R") leftRight[1] = point } else if distance(a: leftRight[0], b: point) < dista..
programmers.co.kr/learn/courses/30/lessons/77484 나의 풀이 import Foundation func solution(_ lottos:[Int], _ win_nums:[Int]) -> [Int] { let zeroCount = lottos.filter { $0 == 0}.count let winCount: Int = win_nums.filter { lottos.contains($0) }.count return [min(7-winCount-zeroCount,6), min(7-winCount,6)] }
programmers.co.kr/learn/courses/30/lessons/76501?language=swift 나의 풀이 import Foundation func solution(_ absolutes:[Int], _ signs:[Bool]) -> Int { return zip(absolutes, signs).map { i, bool in if bool == false { return i * -1 } return i }.reduce(0, +) } 다른 사람의 풀이 import Foundation func solution(_ absolutes:[Int], _ signs:[Bool]) -> Int { var answer = 0 for i in 0..