File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 55링크 : https://school.programmers.co.kr/learn/courses/30/lessons/42586
66*/
77
8+ // ANCHOR - 2025.12.04 풀이 (리뷰 참고)
9+ // https://github.com/yoouyeon/algorithm_study/pull/16#issuecomment-3610881111
10+ function solution2_1 ( progresses , speeds ) {
11+ // 각 작업이 완료되기까지 필요한 일 수 계산
12+ const daysNeeded = progresses . map ( ( progress , index ) =>
13+ Math . ceil ( ( 100 - progress ) / speeds [ index ] )
14+ ) ;
15+ const answer = [ ] ;
16+ let maxDay = daysNeeded [ 0 ] ;
17+ let count = 1 ;
18+
19+ for ( let idx = 1 ; idx < daysNeeded . length ; idx ++ ) {
20+ if ( daysNeeded [ idx ] <= maxDay ) {
21+ // 현재 작업이 앞선 작업보다 빨리 끝난다면 함께 배포
22+ count ++ ;
23+ } else {
24+ // 새로운 배포 그룹 시작
25+ answer . push ( count ) ;
26+ maxDay = daysNeeded [ idx ] ;
27+ count = 1 ;
28+ }
29+ }
30+
31+ // 마지막 그룹 추가
32+ answer . push ( count ) ;
33+
34+ return answer ;
35+ }
36+
837// ANCHOR - 2025.12.04 풀이
938function solution2 ( progresses , speeds ) {
1039 let answer = [ ] ;
You can’t perform that action at this time.
0 commit comments