#1185

Day of the Week

pupil · 455 · lc easy +26 · verified · 59% accepted · 452 likes · top 56%

Description

Given a calendar date expressed as three integers day, month, and year, determine what day of the week it falls on.

Return one of the following strings: {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}.

Note: January 1, 1971 was a Friday.

Example 1:

Input: day = 31, month = 8, year = 2019
Output: "Saturday"

Example 2:

Input: day = 18, month = 7, year = 1999
Output: "Sunday"

Example 3:

Input: day = 15, month = 8, year = 1993
Output: "Sunday"

Code

1
2
3