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/42587
💬 Idea
1. 인쇄 대기목록의 가장 앞에 있는 문서(J)를 대기목록에서 꺼냅니다. 2. 나머지 인쇄 대기목록에서 J보다 중요도가 높은 문서가 한 개라도 존재하면 J를 대기목록의 가장 마지막에 넣습니다. 3. 그렇지 않으면 J를 인쇄합니다.
💬 풀이
import Foundation func solution(_ priorities:[Int], _ location:Int) -> Int { var priorities = priorities.reversed().map({ Int($0) }) var printQueue: [Int] = [] var idx = abs(location - (priorities.count - 1)) while !priorities.isEmpty { let p = priorities.popLast()! if p < priorities.max() ?? p { idx = idx == priorities.count ? 0 : idx + 1 priorities.insert(p, at: 0) } else { printQueue.append(p) if idx == priorities.count { break } } } return printQueue.count }
소요시간 : 30분
소요시간
The text was updated successfully, but these errors were encountered:
#171 - 프린터 문제 풀이
3d61296
hwangJi-dev
No branches or pull requests
💬 문제
https://school.programmers.co.kr/learn/courses/30/lessons/42587
💬 Idea
💬 풀이
소요시간
: 30분The text was updated successfully, but these errors were encountered: