Coding Test/[프로그래머스] Java

[프로그래머스 / Java] Lv.1 2016년

annovation 2025. 5. 7. 09:33

Question

https://school.programmers.co.kr/learn/courses/30/lessons/12901

 

프로그래머스

SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr


Code

class Solution {
    public String solution(int a, int b) {
        String[] day = {"FRI", "SAT", "SUN", "MON", "TUE", "WED", "THU"};
        
        int[] month = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 30};
        
        int answer = 0;
        
        for (int i = 0; i < a - 1; i++) {
            answer += month[i];
        }
        
        answer += b - 1;
        
        return day[answer % 7];
    }
}

출처

https://ittrue.tistory.com/460

 

[프로그래머스] 2016년 - 자바(Java)

문제링크 https://school.programmers.co.kr/learn/courses/30/lessons/12901 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합

ittrue.tistory.com