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
- Find number of days between two given dates
- Tomohiko Sakamoto's Algorithm- Finding the day of the week
- Number of days until all chocolates become unhealthy
- Finding number of days between two dates using StringStream
- Converting seconds into days, hours, minutes and seconds
- Program to calculate the number of odd days in given number of years
- Date after adding given number of days to the given date
- Find the value of max(f(x)) - min(f(x)) for a given F(x)
- Find value of (1^n + 2^n + 3^n + 4^n ) mod 5
- Find (1^n + 2^n + 3^n + 4^n) mod 5 | Set 2
- Find N from the value of N!
- Find value of (n^1 + n^2 + n^3 + n^4) mod 5 for given n
- Find 2^(2^A) % B
- Find the value of f(n) / f(r) * f(n-r)
- Find K such that |A - K| = |B - K|
- Find the sum of the series 2, 5, 13, 35, 97...
- Find minimum x such that (x % k) * (x / k) == n
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.