Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes399downloads
minimum-time-to-complete-all-tasks.json31 linesDownload Raw Back to root
1{2  "id": 2657,3  "name": "minimum-time-to-complete-all-tasks",4  "difficulty": "Hard",5  "link": "https://leetcode.com/problems/minimum-time-to-complete-all-tasks/",6  "date": "2023-03-05",7  "task_description": "There is a computer that can run an unlimited number of tasks **at the same time**. You are given a 2D integer array `tasks` where `tasks[i] = [starti, endi, durationi]` indicates that the `ith` task should run for a total of `durationi` seconds (not necessarily continuous) within the **inclusive** time range `[starti, endi]`. You may turn on the computer only when it needs to run a task. You can also turn it off if it is idle. Return _the minimum time during which the computer should be turned on to complete all tasks_. **Example 1:** ``` **Input:** tasks = [[2,3,1],[4,5,1],[1,5,2]] **Output:** 2 **Explanation:** - The first task can be run in the inclusive time range [2, 2]. - The second task can be run in the inclusive time range [5, 5]. - The third task can be run in the two inclusive time ranges [2, 2] and [5, 5]. The computer will be on for a total of 2 seconds. ``` **Example 2:** ``` **Input:** tasks = [[1,3,2],[2,5,3],[5,6,2]] **Output:** 4 **Explanation:** - The first task can be run in the inclusive time range [2, 3]. - The second task can be run in the inclusive time ranges [2, 3] and [5, 5]. - The third task can be run in the two inclusive time range [5, 6]. The computer will be on for a total of 4 seconds. ``` **Constraints:** `1 <= tasks.length <= 2000` `tasks[i].length == 3` `1 <= starti, endi <= 2000` `1 <= durationi <= endi - starti + 1 `",8  "test_case": [9    {10      "label": "Example 1",11      "input": "tasks = [[2,3,1],[4,5,1],[1,5,2]]",12      "output": "2 "13    },14    {15      "label": "Example 2",16      "input": "tasks = [[1,3,2],[2,5,3],[5,6,2]]",17      "output": "4 "18    }19  ],20  "constraints": [21    "1 <= tasks.length <= 2000",22    "tasks[i].length == 3",23    "1 <= starti, endi <= 2000",24    "1 <= durationi <= endi - starti + 1"25  ],26  "python_template": "class Solution(object):\n    def findMinimumTime(self, tasks):\n        \"\"\"\n        :type tasks: List[List[int]]\n        :rtype: int\n        \"\"\"\n        ",27  "java_template": "class Solution {\n    public int findMinimumTime(int[][] tasks) {\n        \n    }\n}",28  "metadata": {29    "func_name": "findMinimumTime"30  }31}