Minjeong / 5월 3주차 / 4문제 #211
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🌱WIL
🚀주간 목표 문제 수: 3개
프로그래머스 #42583. 다리를 지나는 트럭: 스택큐 / Level2
정리한 링크: (바로가기)
🚩플로우 (선택)
bridge_length만큼)time)을 0으로 설정poll()로 트럭 또는 0을 제거, 하중 차감while탈출 조건)time을 반환🚩제출한 코드
💡TIL
Queue의 핵심 메서드인offer(),poll(),peek()**의 사용법을 꼭 숙지해두자.프로그래머스 #42584. 주식가격: 스택큐 / Level2
정리한 링크: (바로가기)
🚩플로우 (선택)
prices.length만큼의answer[]배열 생성현재 인덱스 - 이전 인덱스answer[이전 인덱스] = 유지시간(마지막 인덱스 - 해당 인덱스)를 할당🚩제출한 코드
💡TIL
백준 #7576. 토마토: 그래프 / 골드5
정리한 링크: (바로가기)
🚩플로우 (선택)
M, 세로N크기를 입력받는다.N줄에 걸쳐 토마토 상태가 담긴 2차원 리스트box를 생성한다.1: 익은 토마토0: 익지 않은 토마토1: 토마토가 없는 칸deque)를 생성하고, 익은 토마토(1)의 좌표를 모두 큐에 넣는다.dx, dy벡터(상, 우, 하, 좌)를 설정한다.day = 0을 선언해, 최종 일수를 저장할 준비를 한다.(x, y)를 꺼낸다.0)라면:현재 값 + 1로 갱신한다 (며칠 째 익은 건지 누적)box전체를 확인한다:0이 남아 있다면 익지 못한 토마토가 있다는 뜻이므로1을 출력하고 종료한다.day에 저장한다.1부터 시작했기 때문에 정답은day - 1이다. 이를 출력한다.🚩제출한 코드
💡TIL
백준 #7569. 토마토: 그래프 / 골드5
정리한 링크: (바로가기)
M, N, H를 입력받고,box[H][N][M]형태의 3차원 리스트를 만든다.queue를 생성하고, 익은 토마토(1)의 좌표를 전부 큐에 추가한다.directions: 총 6방향 설정 (위, 아래, 왼, 오, 앞, 뒤)(z, y, x)를 꺼낸다.0)를 찾는다.box[nz][ny][nx] = box[z][y]+ 1) 큐에 삽입한다.0이 남아 있다면1출력max - 1🚩플로우 (선택)
🚩제출한 코드
💡TIL