Count Sundays in N Days from a Given Start Day
E · easyP · Verified PYQstrings
Problem
Given start day as string (mon/tue/wed/thu/fri/sat/sun) and N (number of days), count how many Sundays fall within N days.
Example
Input
mon 13
Output
2
Map: mon=6,tue=5,wed=4,thu=3,fri=2,sat=1,sun=0. If N >= days_to_sun: ans = 1 + (N - days_to_sun)//7
Starting Monday: first Sunday in 6 days, next in 13 days. Total = 2.