Merged
Conversation
🔥2025-07 챌린지 진행 상황👉 그래프
👉 구현
|
🔥2025-07 챌린지 진행 상황👉 그리디
👉 구현
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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개
프로그래머스 #42885. 구명보트: 그리디 / Level2
정리한 링크: (바로가기)
🚩플로우 (선택)
people을 오름차순으로 정렬한다.left와, 가장 무거운 사람을 가리키는 포인터right를 선언한다.people[left] + people[right] 의 값이 limit보다 작거나 같다면 ⇒ 두 사람 모두 태울 수 있다.
따라서
boat + 1해야 한다. 그 다음, left를 오른쪽으로 한 칸 옮기고(left++), right를 왼쪽으로 한 칸 옮겨야 한다(right—-).people[left] + people[right] 의 값이 limit보다 크다면 ⇒ 몸무게가 더 많이 나가는
people[right]한 사람만 태울 수 있다.따라서 boat + 1한 후 right만 왼쪽으로 한 칸 옮겨야 한다.(
right--)이를
left포인터와right포인터가 서로 교차할 때까지 반복한다.🚩제출한 코드
💡TIL
Array보다는ArrayList를 더 자주 쓰다보니Array에 사용할 수 있는 메소드를 많이 까먹었다. 자바 문법을 다시 리마인드할 수 있는 문제였다.프로그래머스 #42576. 완주하지 못한 선수(java): 구현 / Level1
정리한 링크: (바로가기)
🚩제출한 코드
해시맵 풀이
정렬을 이용한 풀이
💡TIL
프로그래머스 #42628. 이중우선순위큐: 우선순위큐 / Level3
정리한 링크: (바로가기)
🚩플로우 (선택)
min_heap: 원래 값 넣기max_heap: 부호를 반전시킨 값 넣기(파이썬의 heapq 모듈은 최소힙 기반이기 때문)number_count[num](num이 큐에 나온 횟수) 을 +1,size(큐에 잇는 원소 개수)를 +1 해주기size가 0이면 무시.D 1(최댓값 삭제)일 때는max_heap에서 팝(pop)하면서number_count> 0인 첫 값을 찾아 카운트를 –1,size도 –1.D -1(최솟값 삭제)일 때는min_heap에서 동일하게 처리.min_heap과max_heap각각에서 유효한(=number_count[x] > 0) 최댓값과 최솟값을 각각 찾아서 반환🚩제출한 코드
💡TIL
min_heap과max_heap에 각각 어떻게 저장하는 게 좋을지 고민이 됐다. 이min_heap과max_heap을 동기화 처리하는 부분도 헷갈렸다. 이번 문제를 통해서 2개의 힙을 동기화하는 방법을 위해 리스트나 딕셔너리를 사용하면 된다는 것을 알게 되었다.프로그래머스 #17679. 프렌즈4블록: 구현 / Level2
정리한 링크: (바로가기)
🚩플로우 (선택)
🚩제출한 코드
💡TIL