개발일기/TIL(Since24.04.19)
Java&Spring -TIL(24.07.01 월)
w.llama
2024. 7. 1. 21:04
오늘 한 일
- Spring AWS 수강
- HyperSkill 문풀
- 프로그래머스 문풀
- 개인정보 수집 유효기간 (Java)
- 오프라인/온라인 판매 데이터 통합하기 (SQL)
풀이
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/프로그래머스 문풀