Day of the Week

Problem Id: 1185 Difficulty: Easy


Intuition

Solution


class Solution:
    def dayOfTheWeek(self, day: int, month: int, year: int) -> str:
        t = datetime(year=year, day=day, month=month)
        mapping = ['Monday', "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
        return mapping[t.weekday()]