1185. Day of the Week
On This Page
class Solution:
def dayOfTheWeek(self, d: int, m: int, y: int) -> str:
if m < 3:
m += 12
y -= 1
c = y // 100
y = y % 100
w = (c // 4 - 2 * c + y + y // 4 + 13 * (m + 1) // 5 + d - 1) % 7
return [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
][w]