Number of Days Between Two Dates
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given two valid Gregorian dates date1 and date2, each written as YYYY-MM-DD. Return the
absolute number of days between them. The two dates may be in either order, and the answer is 0
when they are equal.
Leap years follow the usual rule: divisible by 4, except years divisible by 100 unless they are also
divisible by 400.
Examples
Constraints
- The given dates are valid dates between the years 1971 and 2100 (inclusive)
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.