Tap here to switch tabs
Problem
Submissions

Problem: Count Days Spent Together

med
30 min
Try to solve the Count Days Spent Together problem.

Statement

Alice and Bob are traveling to Rome. You are given four strings arriveAlice, leaveAlice, arriveBob, and leaveBob.

Alice arrives on arriveAlice and departs on leaveAlice, while Bob arrives on arriveBob and departs on leaveBob.

Return the total number of days that Alice and Bob spend together in Rome.

Note: A day is considered spent together if both Alice and Bob are present in Rome on that day, inclusive of arrival and departure dates.

Constraints:

  • All dates are provided in the format "MM-DD".

  • Alice and Bob arrival dates are earlier than or equal to their respective leaving dates.

  • The given dates are valid dates of a non leap year.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Days Spent Together

med
30 min
Try to solve the Count Days Spent Together problem.

Statement

Alice and Bob are traveling to Rome. You are given four strings arriveAlice, leaveAlice, arriveBob, and leaveBob.

Alice arrives on arriveAlice and departs on leaveAlice, while Bob arrives on arriveBob and departs on leaveBob.

Return the total number of days that Alice and Bob spend together in Rome.

Note: A day is considered spent together if both Alice and Bob are present in Rome on that day, inclusive of arrival and departure dates.

Constraints:

  • All dates are provided in the format "MM-DD".

  • Alice and Bob arrival dates are earlier than or equal to their respective leaving dates.

  • The given dates are valid dates of a non leap year.