Given current day as day of the week and an integer K, the task is to find the day of the week after K days.
Input: day = “Monday”, K = 3
Input: day = “Tuesday”, K = 101
- Store all the days of the week (Mon to Sun) in a list.
- Find the index of the current day from that list.
- Print the value stored in
((K + index) % 7)th index
in the array.
Below code is the implementation of the above approach:
Time Complexity: O(1)
Space Complexity: O(1)
- Total number of days taken to complete the task if after certain days one person leaves
- Program to convert given number of days in terms of Years, Weeks and Days
- Find day of the week for a given date
- Tomohiko Sakamoto's Algorithm- Finding the day of the week
- Date after adding given number of days to the given date
- Count of days remaining for the next day with higher temperature
- Find number of days between two given dates
- Find temperature of missing days using given sum and average
- Find array sum using Bitwise OR after splitting given array in two halves after K circular shifts
- Program to calculate the number of odd days in given number of years
- Find the day number in the current year for the given date
- Finding number of days between two dates using StringStream
- Number of days until all chocolates become unhealthy
- Converting seconds into days, hours, minutes and seconds
- C program to print number of days in a month
- Zeller's Congruence | Find the Day for a Date
- Program to find the time remaining for the day to complete
- Maximize Profit by trading stocks based on given rate per day
- Find the Initial Array from given array after range sum queries
- Find the k largest numbers after deleting the given elements
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.