Back to problems

Classify the Difference Between Two Calendar Dates

Algorithm · Apple · Medium

Date Difference Classification Easy · Date, Simulation · Company Tags · Hints Implement a function classify(date1, date2) that returns one of three string labels describing the calendar interval between two dates: EXACTLY_ONE_MONTH WITHIN_ONE_MONTH OVER_ONE_MONTH Both dates are in fixed YYYY-MM-DD format, are valid Gregorian calendar dates, and satisfy date1 <= date2. Time-of-day and time zones are not considered. First, calculate the number of whole months between the two…

Checking your access…