# Process
# 1. Input priorities, location
# 2. Make location_tracker plate for the location index I need to know
# 3. Iterate while remaining priorities
# 3.1. Pop first index of priority from the queue
# 3.2. Check if bigger priority is exist or not
# 3.2.1. If so -> change the priorites queue and location tracking queue
# 3.3. Check if it's poped permanently
# 3.3.1. Count answer
# 3.3.2. If the index I need to know is poped permanently, then finish the process
# 4. Return answer
def solution(priorities, location):
answer = 0
isDone = False
# 2.
location_index_plate = []
for i in range(0, len(priorities)):
location_index_plate.append(False)
if i is location:
location_index_plate[i] = True
# 3.
i = 0
while i < len(priorities) and not isDone:
best_priority = True
priority = priorities.pop(i)
tracing_index = location_index_plate.pop(i)
# 3.2.
j = 0
while j < len(priorities) and best_priority:
if priorities[j] > priority:
priorities.append(priority)
location_index_plate.append(tracing_index)
best_priority = False
j += 1
# 3.3.
if best_priority:
answer += 1
if tracing_index:
isDone = True
return answer
2020/10/07 - [Life/Item review] - Lenovo 레노보 씽크패드 Thinkpad 빨콩 무선키보드/블루투스/울트라나브2/트랙키보드 구매 후기
Lenovo 레노보 씽크패드 Thinkpad 빨콩 무선키보드/블루투스/울트라나브2/트랙키보드 구매 후기
빨콩 + 키감 + 무선 울트라나브2 를 기다리다가 최근 나왔길래 고민안하고 샀다. -> 가격 13만 5천원 내외였던 것 같은데 음.. 가성비는 그닥 -> 빨콩 예전 x1 이후에 간만에 빨콩을 쓰니 손이 잘 안
itdar.tistory.com
.Net Entity class / DB migration command / 닷넷 / 데이터베이스 마이그레이션 명령어 / DotNet / C sharp / 씨샵
.Net Entity class / DB migration command / 닷넷 / 데이터베이스 마이그레이션 명령어/DotNet/Csharp/씨샵/씨샾/EntityFrameworkCore/엔티티프레임워크코어 - DB migration 하는 방법 (DB 최초 생성 ..
itdar.tistory.com
2019/10/09 - [Computer/General] - 정보처리기사 실기/필기 - IT신기술동향_전산영어 요점 정리
2019/10/07 - [Computer/General] - 정보처리기사 실기/필기 - 업무 프로세스 요점 정리
정보처리기사 실기/필기 - 업무 프로세스 요점 정리
필기 붙어놓고 실기는 미루고 미루다가 마지막 기회라서 부랴부랴 접수하고 벼락치기 중.. 2019/10/09 - [Computer/General] - 정보처리기사 실기/필기 - IT신기술동향_전산영어 요점 정리 정보처리기사
itdar.tistory.com