프로그래밍/프로그래머스

[프로그래머스] 2016년

Reference M1 2019. 10. 5. 00:50

 

 

이번 문제는 알고리즘 적으로 접근해도 되지만 간단한 날짜, 요일 시간 표출에 대한 것은 잘 만들어진 API를 쓰는 게 더 효율적이라 생각된다.

import java.time.LocalDate;

class Solution {
  public String solution(int a, int b) {
      
      LocalDate localDate = LocalDate.of(2016, a, b);
      return localDate.getDayOfWeek().toString().substring(0,3);
  }
}