개발일기/TIL(Since24.04.19)

Java&Spring -TIL(24.06.21 금)

w.llama 2024. 6. 21. 21:03

오늘 한 일

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

풀이

class Solution {
    public int[] solution(int[] lottos, int[] win_nums) {
        int[] answer = {0,0};
        int zero = 0, same=0;
        for(int i=0; i<lottos.length; i++){
            if(lottos[i] == 0){
                zero++;
                continue;    
            }
            for(int j=0;j<win_nums.length; j++){
                if(lottos[i] == win_nums[j])
                    same++;
            }
        }
        answer[0] = 7-(zero+same);
        answer[1] = 7-same;
        if(zero + same < 2)
            answer[0] = answer[1] = 6;
        if(answer[1] == 7)
            answer[1]--;
        return answer;
    }
}

주말 할 일

Spring 과제 진행 (댓글 /게시글 좋아요 기능 구현)

HyperSkill/프로그래머스 문풀