Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- Git
- combinations
- HTTP 완벽 가이드
- was
- Programmers
- Django
- AWS
- utils
- Unit Testing
- SQL
- 백준
- Bruteforce
- stateless
- postreSQL
- ws
- ORM
- Stack
- Gunicorn
- codecov
- stack&que
- Python
- Query
- greedy
- permutations
- pytest
- TDD
- Q objects
- stateful
- algorithm
- dictionary
Archives
- Today
- Total
해피 코딩!
[프로그래머스] 프린터 본문
link
def solution(priorities, location):
answer = []
lst = [i for i in range(len(priorities))]
while priorities:
if priorities[0] == max(priorities):
answer.append(lst.pop(0))
priorities.pop(0)
else:
lst.append(lst.pop(0))
priorities.append(priorities.pop(0))
return answer.index(location)+1
'알고리즘' 카테고리의 다른 글
[백준] 블랙잭 2798번 (0) | 2020.12.12 |
---|---|
[백준] 덩치 7568번 (0) | 2020.12.12 |
[프로그래머스] 주식가격 (0) | 2020.12.12 |
[프로그래머스] 완주하지 못한 선수 (0) | 2020.12.12 |
[프로그래머스] 모의고사 (0) | 2020.12.12 |
Comments