最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

LeetCode 2409. Count Days Spent Together

2023-03-30 14:21 作者:您是打尖兒還是住店呢  | 我要投稿

Alice and Bob are traveling to Rome for separate business meetings.

You are given 4 strings?arriveAlice,?leaveAlice,?arriveBob, and?leaveBob. Alice will be in the city from the dates?arriveAlice?to?leaveAlice?(inclusive),

while Bob will be in the city from the dates?arriveBob?to?leaveBob?(inclusive). Each will be a 5-character string in the format?"MM-DD", corresponding to the month and day of the date.

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

You can assume that all dates occur in the?same?calendar year, which is?not?a leap year. Note that the number of days per month can be represented as:?

[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31].

?

Example 1:

Input: arriveAlice = "08-15", leaveAlice = "08-18",?

arriveBob = "08-16", leaveBob = "08-19"

Output: 3

Explanation: Alice will be in Rome from August 15 to August 18. Bob will be in Rome from August 16 to August 19. They are both in Rome together on August 16th, 17th, and 18th, so the answer is 3.

Example 2:

Input: arriveAlice = "10-01", leaveAlice = "10-31", arriveBob = "11-01", leaveBob = "12-31"

Output: 0

Explanation: There is no day when Alice and Bob are in Rome together, so we return 0.

?

Constraints:

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

  • Alice and Bob's arrival dates are?earlier than or equal to?their leaving dates.

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

是知道能過(guò)的,但是不知道能超過(guò)100%。。。我腦子還稍微能管用一點(diǎn)點(diǎn)。。。

Runtime:?0 ms, faster than?100.00%?of?Java?online submissions for?Count Days Spent Together.

Memory Usage:?40.4 MB, less than?56.73%?of?Java?online submissions for?Count Days Spent Together.


LeetCode 2409. Count Days Spent Together的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
邓州市| 论坛| 呈贡县| 腾冲县| 都匀市| 密云县| 山阴县| 天祝| 雅江县| 陆丰市| 南雄市| 梅州市| 延边| 耒阳市| 巴彦淖尔市| 扶绥县| 萝北县| 江油市| 高平市| 五指山市| 南靖县| 丰原市| 泰和县| 乡城县| 新密市| 嘉义县| 闻喜县| 福安市| 绥德县| 牡丹江市| 张家川| 静乐县| 麻栗坡县| 新津县| 荃湾区| 白水县| 呼和浩特市| 玉屏| 盘山县| 兰考县| 宁波市|