💬 문제
https://app.codility.com/programmers/lessons/2-arrays/odd_occurrences_in_array/
💬 Idea
- 배열의 count를 dictionary에 저장한 다음, 짝수개를 가지는 key를 모두 제거하고 남는 하나의 key를 리턴한다.
💬 풀이
import Foundation
publicfunc solution(B :inout[Int])->Int{varcountDict:[Int:Int]=[:]foriin B {ifcountDict[i]==nil{countDict[i]=1}else{countDict[i]! +=1}}return countDict.filter{ $0.value %2==1}.first!.key
}소요시간 : 11분
https://app.codility.com/demo/results/training95K8QQ-KYV/
💬 문제https://app.codility.com/programmers/lessons/2-arrays/odd_occurrences_in_array/
💬 Idea💬 풀이소요시간: 11분https://app.codility.com/demo/results/training95K8QQ-KYV/