8/21
·
TIL
뉴스피드 프로젝트@ValidPassword 오작동 문제문제 상황@Constraint(validatedBy = PasswordValidator.class)@Target({ElementType.FIELD})@Retention(RetentionPolicy.RUNTIME)public @interface ValidPassword { String message() default "비밀번호는 8~20자이며, 대소문자/숫자/특수문자를 최소 1글자씩 포함해야 합니다."; Class[] groups() default {}; Class[] payload() default {};}비밀번호 유효성 검증을 위한 커스텀 어노테이션 @ValidPassword와 검증을 수행할 PasswordValidator 클래스 정..
8/20
·
TIL
Today's Codekata# Game Play Analysis IVSELECT ROUND( COUNT(DISTINCT a.player_id) / (SELECT COUNT(DISTINCT player_id) FROM Activity), 2 ) AS fractionFROM Activity aJOIN ( SELECT player_id, MIN(event_date) AS first_login FROM Activity GROUP BY player_id) first ON a.player_id = first.player_id AND a.event_date = DATE_ADD(first.first_login, INTERVAL 1 DAY); # Number of Unique Subjects ..
8/19
·
TIL
Today's Codekataclass Solution { public int[] solution(String[] park, String[] routes) { int height = park.length; int width = park[0].length(); int x = 0, y = 0; for (int i = 0; i = height || tempY >= width) { isValid = false; break; } if (park[tempX].charAt(tempY) == 'X') { isV..
8/18
·
TIL
Today's Codekata// 달리기 경주class Solution { public String[] solution(String[] players, String[] callings) { Map map = new HashMap(); for (int i = 0; i # Average Selling PriceSELECT p.product_id, IFNULL(ROUND(SUM(p.price * u.units) / SUM(u.units), 2), 0) AS average_priceFROM Prices pLEFT JOIN UnitsSold u ON p.product_id = u.product_id AND u.purchase_date BETWEEN p..
8/17
·
TIL
Today's Codekata// 개인정보 수집 유효기간class Solution { public int[] solution(String today, String[] terms, String[] privacies) { Map termMap = new HashMap(); for (String term : terms) { String[] split = term.split(" "); termMap.put(split[0], Integer.parseInt(split[1])); } int todayDays = toDays(today); List result = new ArrayList(); for..
8/16
·
TIL
Today's Codekata// 성격 유형 검사하기class Solution { public String solution(String[] survey, int[] choices) { String answer = ""; Map map = new HashMap(); for (char c : new char[]{'R', 'T', 'C', 'F', 'J', 'M', 'A', 'N'}) { map.put(c, 0); } for (int i = 0; i 4) { map.put(survey[i].charAt(1), map.get(survey[i].charAt(1)) + score); ..
8/15
·
TIL
Today's Codekata// 햄버거 만들기class Solution { public int solution(int[] ingredient) { int answer = 0; List list = new ArrayList(); for (int i : ingredient) { list.add(i); if (list.size() >= 4 && list.get(list.size() - 4) == 1 && list.get(list.size() - 3) == 2 && list.get(list.size() - 2) == 3 && list.get(list.size()..
8/14
·
TIL
Today's Codekata// 둘만의 암호class Solution { public String solution(String s, String skip, int index) { StringBuilder answer = new StringBuilder(); Set skipSet = new HashSet(); for (char c : skip.toCharArray()) { skipSet.add(c); } for (char c : s.toCharArray()) { int count = 0; char temp = c; while (count 'z') temp =..
8/13
·
TIL
Today's Codekata// 문자열 나누기class Solution { public int solution(String s) { int answer = 0; int i = 0; while (i // 대충 만든 자판class Solution { public int[] solution(String[] keymap, String[] targets) { int[] answer = new int[targets.length]; Map minPress = new HashMap(); for (String key : keymap) { for (int i = 0; i 이번 문제를 풀면서 처음으로 Map 자료구조를..
8/12
·
TIL
Today's Codekata// 체육복class Solution { public int solution(int n, int[] lost, int[] reserve) { Arrays.sort(lost); Arrays.sort(reserve); for (int i = 0; i -- 특정 기간동안 대여 가능한 자동차들의 대여비용 구하기SELECT CAR_ID, CAR_TYPE, FEEFROM ( SELECT C.CAR_ID, C.CAR_TYPE, ROUND(C.DAILY_FEE * 30 * (1 - D.DISCOUNT_RATE / 100)) AS FEE FROM CAR_RENTAL_COMPANY_CAR C JOIN ( SE..