Skip to content

Conversation

@jjuchan
Copy link
Collaborator

@jjuchan jjuchan commented Jul 7, 2025

📌 문제 링크

프로그래머스 42586번 - 기능개발

image


📝 문제 개요

  • 기능별 개발 진척도가 다르고, 매일 일정한 속도로 작업이 진행됩니다.
  • 앞에 있는 기능이 배포될 때, 뒤에 완료된 기능들도 함께 배포됩니다.
  • 각 배포마다 몇 개의 기능이 배포되는지 구하는 문제입니다.

🧩 풀이 과정 요약

  1. 각 기능별 현재 진행도와 개발 속도를 이용해 완료까지 필요한 날짜를 계산합니다.
  2. 계산된 날짜를 큐에 저장하여 작업 순서를 유지합니다.
  3. 큐에서 가장 앞에 있는 작업의 완료 날짜를 기준으로, 그 날짜 이전 또는 같은 날짜에 완료되는 작업들을 함께 묶습니다.
  4. 묶인 작업의 개수를 결과 리스트에 저장합니다.
  5. 모든 작업을 처리할 때까지 위 과정을 반복하여 최종 결과 리스트를 완성합니다.

😁 결과

image

Copy link
Member

@Yoepee Yoepee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queue를 이용해서 깔끔하게 잘 푸신 것 같습니다.
List형식을 int[]로 바꾸는 메소드를 이용해도 좋을 것 같습니다.

static class Solution {
public int[] solution(int[] progresses, int[] speeds) {
// 각 작업이 완료되기까지 남은 '일 수'를 저장할 큐
Queue<Integer> queue = new LinkedList<>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queue 구현체 중에서 ArrayDeque가 가장 성능이 좋다고 알고 있어서 데이터 수가 많아지면 ArrayDeque 사용도 고려해보면 좋을 것 같아요!

@Yoepee Yoepee merged commit ee2bd58 into main Jul 14, 2025
1 check passed
@jjuchan jjuchan deleted the feat/pg42586-juchan branch July 14, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants