- 월~일 이 반복되는 구조이기 때문에 큐를 사용해 해결
import java.util.*;
class Solution {
public String solution(int a, int b) {
Queue<String> q = new LinkedList<>();
int[] howDay = new int[13];
howDay[0] = 0;
howDay[1] = 31; howDay[2] = 29; howDay[3] = 31;
howDay[4] = 30; howDay[5] = 31; howDay[6] = 30;
howDay[7] = 31; howDay[8] = 31; howDay[9] = 30;
howDay[10] = 31; howDay[11] = 30; howDay[12] = 31;
q.offer("FRI"); q.offer("SAT"); q.offer("SUN");
q.offer("MON"); q.offer("TUE"); q.offer("WED");
q.offer("THU");
int curDate = b;
for(int i=0; i<a; ++i)
curDate += howDay[i];
for(int i=1; i<curDate; ++i)
q.offer(q.poll());
String answer = q.poll();
return answer;
}
}