Company: Optiver
Difficulty: easy
Days Between Two Dates Write a function daysBetween that returns the number of days between two calendar dates. Each date is given as three integers: year , month and day . The first date is guaranteed not to occur after the second date. Do not use system-provided date objects or built-in date-difference helpers. Compute the answer directly from the date components. All dates follow the Gregorian calendar, extended backwards to year 1. A year is a leap year when it is divisible by 4, except that years divisible by 100 are not leap years unless they are also divisible by 400. So 2024 and 2000 are leap years, while 1900 and 2100 are not. Function daysBetween(year1: int, month1: int, day1: int, year2: int, month2: int, day2: int) -> int daysBetween has the following parameters: int year1 : the year of the first date int month1 : the month of the first date int day1 : the day of the first date int year2 : the year of the second date int month2 : the month of the second date int day2 : t