Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes399downloads
task-scheduler-ii.json32 linesDownload Raw Back to root
1{2  "id": 2483,3  "name": "task-scheduler-ii",4  "difficulty": "Medium",5  "link": "https://leetcode.com/problems/task-scheduler-ii/",6  "date": "2022-07-23",7  "task_description": "You are given a **0-indexed** array of positive integers `tasks`, representing tasks that need to be completed **in order**, where `tasks[i]` represents the **type** of the `ith` task. You are also given a positive integer `space`, which represents the **minimum** number of days that must pass **after** the completion of a task before another task of the **same** type can be performed. Each day, until all tasks have been completed, you must either: Complete the next task from `tasks`, or Take a break. Return_ the **minimum** number of days needed to complete all tasks_. **Example 1:** ``` **Input:** tasks = [1,2,1,2,3,1], space = 3 **Output:** 9 **Explanation:** One way to complete all tasks in 9 days is as follows: Day 1: Complete the 0th task. Day 2: Complete the 1st task. Day 3: Take a break. Day 4: Take a break. Day 5: Complete the 2nd task. Day 6: Complete the 3rd task. Day 7: Take a break. Day 8: Complete the 4th task. Day 9: Complete the 5th task. It can be shown that the tasks cannot be completed in less than 9 days. ``` **Example 2:** ``` **Input:** tasks = [5,8,8,5], space = 2 **Output:** 6 **Explanation:** One way to complete all tasks in 6 days is as follows: Day 1: Complete the 0th task. Day 2: Complete the 1st task. Day 3: Take a break. Day 4: Take a break. Day 5: Complete the 2nd task. Day 6: Complete the 3rd task. It can be shown that the tasks cannot be completed in less than 6 days. ``` **Constraints:** `1 <= tasks.length <= 105` `1 <= tasks[i] <= 109` `1 <= space <= tasks.length`",8  "test_case": [9    {10      "label": "Example 1",11      "input": "tasks = [1,2,1,2,3,1], space = 3",12      "output": "9 "13    },14    {15      "label": "Example 2",16      "input": "tasks = [5,8,8,5], space = 2",17      "output": "6 "18    }19  ],20  "constraints": [21    "Complete the next task from tasks, or",22    "Take a break.",23    "1 <= tasks.length <= 105",24    "1 <= tasks[i] <= 109",25    "1 <= space <= tasks.length"26  ],27  "python_template": "class Solution(object):\n    def taskSchedulerII(self, tasks, space):\n        \"\"\"\n        :type tasks: List[int]\n        :type space: int\n        :rtype: int\n        \"\"\"\n        ",28  "java_template": "class Solution {\n    public long taskSchedulerII(int[] tasks, int space) {\n        \n    }\n}",29  "metadata": {30    "func_name": "taskSchedulerII"31  }32}