We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💬 문제
[코딩테스트 연습 - 실패율](https://school.programmers.co.kr/learn/courses/30/lessons/42889)
💬 Idea
기준 사용자
총 사용자의 수
stage1,2에서 머무른 사용자의 수
💬 풀이
func solution(_ N:Int, _ stages:[Int]) -> [Int] { var stageDict: [Int: Int] = [:] for i in 1...N { stageDict[i] = 0 } for i in stages { stageDict[i] = stageDict[i] != nil ? stageDict[i]! + 1 : 1 } var stageCount = stages.count var failureDict: [Int: Double] = [:] for i in stageDict.keys.filter({ $0 <= N }).sorted() { failureDict[i] = Double(stageDict[i]!)/Double(stageCount) stageCount -= stageDict[i]! } var sortedDict = failureDict.sorted { $0.key < $1.key } sortedDict = sortedDict.sorted { $0.value > $1.value } return sortedDict.map { $0.key } }
💬 알게된 문법
Double(num1)/Double(num2)
The text was updated successfully, but these errors were encountered:
#23 - 실패율 문제 풀이
d394305
hwangJi-dev
No branches or pull requests
💬 문제
[코딩테스트 연습 - 실패율](https://school.programmers.co.kr/learn/courses/30/lessons/42889)
💬 Idea
기준 사용자
=총 사용자의 수
-stage1,2에서 머무른 사용자의 수
이다.💬 풀이
💬 알게된 문법
⭐️ 나누기 할 때 소수점 이하의 숫자가 필요한 경우
The text was updated successfully, but these errors were encountered: