sm 기술 블로그
스킬체크 테스트 레벨1 본문
-문제1
class Solution {
public int solution(String s) {
int answer = 0;
answer = Integer.parseInt(s);
return answer;
}
}
-문제2
import java.util.ArrayList;
class Solution {
public String solution(int a, int b) {
String answer = "";
int total = 0;
ArrayList<String> day = new ArrayList<>();
day.add("THU");//0
day.add("FRI");
day.add("SAT");
day.add("SUN");
day.add("MON");
day.add("TUE");
day.add("WED");//6
switch(a){
case 1: answer = day.get(b%7);
break;
case 2: answer = day.get((b+31)%7);
break;
case 3: answer = day.get((b+60)%7);
break;
case 4: answer = day.get((b+91)%7);
break;
case 5: answer = day.get((b+121)%7);
break;
case 6: answer = day.get((b+152)%7);
break;
case 7: answer = day.get((b+182)%7);
break;
case 8: answer = day.get((b+213)%7);
break;
case 9: answer = day.get((b+244)%7);
break;
case 10: answer = day.get((b+274)%7);
break;
case 11: answer = day.get((b+305)%7);
break;
case 12: answer = day.get((b+335)%7);
break;
}
return answer;
}
}
Comments