Tap here to switch tabs
Problem
Submissions

Problem: Count Days Spent Together

Count Days Spent Together gives Alice's and Bob's arrival and departure dates in Rome. Return the number of calendar days they are both there, counting arrival and departure days.

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

Count Days Spent Together gives Alice's and Bob's arrival and departure dates in Rome. Return the number of calendar days they are both there, counting arrival and departure days.

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.