📕메모
스택: LIFO, 후입선출
큐: FIFO, 선입선출
python에서 ...
스택은 pop(), append() 사용
큐는 pop(0), append() 사용
✏️ 문제
1. lv2 기능개발
https://github.com/eunznidang/BackJoonPython/tree/main/프로그래머스/2/42586.%E2%80%85기능개발
BackJoonPython/프로그래머스/2/42586. 기능개발 at main · eunznidang/BackJoonPython
This is an auto push repository for Baekjoon Online Judge created with [BaekjoonHub](https://github.com/BaekjoonHub/BaekjoonHub). - eunznidang/BackJoonPython
github.com
람다 사용법
lambda (x, y: (x+y-1) // y, arr, speeds)
이때, x+y-1: 은 math.ceil과 같음. 난 Import math 하기 싫어서 이렇게 했다.
2. lv2 프로세스
https://github.com/eunznidang/BackJoonPython/tree/main/프로그래머스/2/42587.%E2%80%85프로세스
BackJoonPython/프로그래머스/2/42587. 프로세스 at main · eunznidang/BackJoonPython
This is an auto push repository for Baekjoon Online Judge created with [BaekjoonHub](https://github.com/BaekjoonHub/BaekjoonHub). - eunznidang/BackJoonPython
github.com
for p in priorities:
queue.append([idx, p])
idx+=1
이 코드는
queue=[(i,p) for i,p in enumerate(priorities)]
이렇게 enumerate 사용해서 바꿀 수 있다. 앞으로 인덱스랑 값 set 만들 땐 이렇게 사용해야지
3. lv2 주식가격
https://github.com/eunznidang/BackJoonPython/tree/main/프로그래머스/2/42584.%E2%80%85주식가격
BackJoonPython/프로그래머스/2/42584. 주식가격 at main · eunznidang/BackJoonPython
This is an auto push repository for Baekjoon Online Judge created with [BaekjoonHub](https://github.com/BaekjoonHub/BaekjoonHub). - eunznidang/BackJoonPython
github.com
4. lv2 트럭
BackJoonPython/프로그래머스/2/42583. 다리를 지나는 트럭 at main · eunznidang/BackJoonPython
This is an auto push repository for Baekjoon Online Judge created with [BaekjoonHub](https://github.com/BaekjoonHub/BaekjoonHub). - eunznidang/BackJoonPython
github.com
bridge: 빈 곳은 -1, 트럭 있는 곳은 트럭의 weight로 채워지는 list
out_truck: 다리를 나가는 트럭
in_truck: 다리에 들어오는 트럭
'코딩테스트' 카테고리의 다른 글
백준 - 단기간 성장 1 (2) | 2025.01.28 |
---|---|
백준 - 브루트 포스 (1) | 2025.01.21 |
[PCCP 기출문제] 3번 / 충돌위험 찾기 (0) | 2024.10.12 |
[PCCP 기출문제] 2번 / 퍼즐 게임 챌린지 (8) | 2024.10.09 |
[PCCP 기출문제] 1번 / 동영상 재생기 (0) | 2024.10.07 |