Day69

강태훈·2026년 4월 9일

nbcamp TIL

목록 보기
69/97

알고리즘 코드카타

Rising Temperature

select a.id
from Weather a
left join Weather b
on a.recordDate = b.recordDate + INTERVAL 1 DAY // 날짜 하루 추가!
where a.temperature > b.temperature   
;

과일 장수

import java.util.Arrays;
import java.util.Collections;

class Solution {
    public int solution(int k, int m, int[] score) {
        int answer = 0;
        int box = score.length/m;

        int[] apple = Arrays.stream(score)
                .boxed()
                .sorted(Collections.reverseOrder())
                .mapToInt(Integer::intValue)
                .toArray();
        
        for(int i=0; i<box; i++){
            answer += apple[i*m+m-1] * m;
        }

        return answer;
    }
}
  • 할때마다 짜증나는 역순 정렬...왜 기본형 배열은 역순 정렬 기능이 없을까...?

0개의 댓글