CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes305downloads
1{2    "id": 2496,3    "name": "count_days_spent_together",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/count-days-spent-together/",6    "date": "1662163200000",7    "task_description": "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.",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "arriveAlice = \"08-15\", leaveAlice = \"08-18\", arriveBob = \"08-16\", leaveBob = \"08-19\"",12            "output": "3 "13        },14        {15            "label": "Example 2",16            "input": "arriveAlice = \"10-01\", leaveAlice = \"10-31\", arriveBob = \"11-01\", leaveBob = \"12-31\"",17            "output": "0 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                "\"10-15\"",24                "\"11-29\"",25                "\"10-05\"",26                "\"10-15\""27            ],28            "output": 129        },30        {31            "input": [32                "\"12-30\"",33                "\"12-31\"",34                "\"02-06\"",35                "\"12-30\""36            ],37            "output": 138        },39        {40            "input": [41                "\"05-29\"",42                "\"07-18\"",43                "\"07-18\"",44                "\"10-07\""45            ],46            "output": 147        },48        {49            "input": [50                "\"04-06\"",51                "\"12-18\"",52                "\"09-24\"",53                "\"10-21\""54            ],55            "output": 2856        },57        {58            "input": [59                "\"04-15\"",60                "\"05-22\"",61                "\"05-22\"",62                "\"12-31\""63            ],64            "output": 165        },66        {67            "input": [68                "\"09-10\"",69                "\"10-01\"",70                "\"07-01\"",71                "\"09-10\""72            ],73            "output": 174        },75        {76            "input": [77                "\"09-08\"",78                "\"12-01\"",79                "\"06-25\"",80                "\"11-01\""81            ],82            "output": 5583        },84        {85            "input": [86                "09-12",87                "10-09",88                "05-06",89                "12-09"90            ],91            "output": 2892        },93        {94            "input": [95                "09-18",96                "12-05",97                "02-22",98                "10-19"99            ],100            "output": 32101        },102        {103            "input": [104                "03-24",105                "11-23",106                "11-23",107                "12-06"108            ],109            "output": 1110        }111    ],112    "haskell_template": "countDaysTogether :: String -> String -> String -> String -> Int\ncountDaysTogether arriveAlice leaveAlice arriveBob leaveBob ",113    "ocaml_template": "let countDaysTogether (arriveAlice: string) (leaveAlice: string) (arriveBob: string) (leaveBob: string) : int =  ",114    "scala_template": "def countDaysTogether(arriveAlice: String,leaveAlice: String,arriveBob: String,leaveBob: String): Int = { \n    \n}",115    "java_template": "public static int countDaysTogether(String arriveAlice, String leaveAlice, String arriveBob, String leaveBob) {\n\n}",116    "python_template": "class Solution(object):\n    def countDaysTogether(self, arriveAlice, leaveAlice, arriveBob, leaveBob):\n        \"\"\"\n        :type arriveAlice: str\n        :type leaveAlice: str\n        :type arriveBob: str\n        :type leaveBob: str\n        :rtype: int\n        \"\"\"\n        "117}