Day of the Week Calculation

Your task is to create a function that determines the day of the week for any given date, whether in the past or the future.

Input:

The first line consists of an integer 'T', representing the number of queries. Each query line contains three integers: 'Day', 'Month', and 'Year'.

Output:

For each query, output the corresponding day of the week as a single string: {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}.

Example:

For the input date 28 8 2020, the output should be Friday because 28th August 2020 is a Friday.

Constraints:

  • 1 <= T <= 10^5
  • 1 <= Day <= 31
  • 1 <= Month <= 12
  • 1 <= Year <= 2,000,000

Time Limit: 1 second.

Note:
The input is guaranteed to be a valid date.
Be the first one to answer
Add answer anonymously...
Microsoft Corporation Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter