Practice/Microsoft/Leetcode 1185. Day of the Week
CodingMust
You are given three integers representing a calendar date: the day of the month, the month number, and the year. Your task is to compute which day of the week that date corresponds to.
Return the name of the weekday as a string: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", or "Saturday".
All input dates are guaranteed to be valid calendar dates within the range from January 1, 1971 to December 31, 2100, inclusive.
day (1-31), month (1-12), and year (1971-2100)Example 1:
Input: day = 15, month = 8, year = 1995 Output: "Tuesday" Explanation: August 15, 1995 fell on a Tuesday.
Example 2:
Input: day = 29, month = 2, year = 2020 Output: "Saturday" Explanation: 2020 was a leap year, so February 29 existed and was a Saturday.
Example 3:
Input: day = 1, month = 1, year = 2000 Output: "Saturday" Explanation: The first day of the new millennium was a Saturday.