개발일기/TIL(Since24.04.19)

Java&Spring -TIL(24.07.01 월)

w.llama 2024. 7. 1. 21:04

오늘 한 일

  • Spring AWS 수강
  • HyperSkill 문풀
  • 프로그래머스 문풀

풀이

import java.util.*;

class Solution {
    public int[] solution(String today, String[] terms, String[] privacies) {
        ArrayList<Integer> answer = new ArrayList<>();
        HashMap<String, Integer> map = new HashMap<>();
        
        int date = getDate(today);

        for (String s : terms) {
            String[] term = s.split(" ");
            map.put(term[0], Integer.parseInt(term[1]));
        }
        
        for (int i = 0; i < privacies.length; i++) {
            String[] privacy = privacies[i].split(" ");

            if (getDate(privacy[0]) + (map.get(privacy[1]) * 28) <= date) {
                answer.add(i + 1);
            }
        }
        return answer.stream().mapToInt(integer -> integer).toArray();
    }

    private int getDate(String today) {
        String[] date = today.split("\\.");
        int year = Integer.parseInt(date[0]);
        int month = Integer.parseInt(date[1]);
        int day = Integer.parseInt(date[2]);
        return (year * 12 * 28) + (month * 28) + day;
    }
}

내일 할 일

Spring JPA 과제 및 모의면접 준비

HyperSkill/프로그래머스 문풀

 

 

'개발일기 > TIL(Since24.04.19)' 카테고리의 다른 글

Java&Spring -TIL(24.07.03 수)  (0) 2024.07.03
Java&Spring -TIL(24.07.02 화)  (0) 2024.07.02
Java&Spring -TIL(24.06.28 금)  (0) 2024.06.28
Java&Spring -TIL(24.06.27 목)  (0) 2024.06.27
Java&Spring -TIL(24.06.26 수)  (0) 2024.06.26