Update appNew update is available. Click here to update.
Topics

Day 1 : Day of the Week

Easy
0/40
Average time to solve is 10m
profile
Contributed by
80 upvotes
MicrosoftAdobeMindtree
+2 more companies

Problem statement

Write a function that calculates the corresponding day of the week for any particular date in the past or future.

For example, for the date 28th August 2020 happens to be Friday. Hence the expected output will be Friday.

Detailed explanation ( Input/output format, Notes, Images )
Constraints :
1 <= T <= 10 ^ 5
1 <= Day <= 31
1 <= Month <= 12
1 <= Year <= 2,000,000

Time Limit : 1 sec.
Sample Input 1 :
4
28 8 2020
20 4 2033
29 2 1920
27 4 1999
Sample Output 1 :
Friday
Wednesday
Sunday
Tuesday
Explanation to Sample Input 1 :
It's Friday on 28th August 2020
It's Wednesday on 20th April 2033
It's Sunday on 29th February 1920
It's Tuesday on 27th April 1999
Sample Input 2:
1
28 2 1994
Sample Output 2 :
Monday
Explanation to Sample Input 2 :
It's Monday on 28th February 1994
Full screen
Console