FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 2294,3 "name": "minimum-time-to-complete-trips",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/minimum-time-to-complete-trips/",6 "date": "2022-02-20",7 "task_description": "You are given an array `time` where `time[i]` denotes the time taken by the `ith` bus to complete **one trip**. Each bus can make multiple trips **successively**; that is, the next trip can start **immediately after** completing the current trip. Also, each bus operates **independently**; that is, the trips of one bus do not influence the trips of any other bus. You are also given an integer `totalTrips`, which denotes the number of trips all buses should make **in total**. Return _the **minimum time** required for all buses to complete **at least** _`totalTrips`_ trips_. **Example 1:** ``` **Input:** time = [1,2,3], totalTrips = 5 **Output:** 3 **Explanation:** - At time t = 1, the number of trips completed by each bus are [1,0,0]. The total number of trips completed is 1 + 0 + 0 = 1. - At time t = 2, the number of trips completed by each bus are [2,1,0]. The total number of trips completed is 2 + 1 + 0 = 3. - At time t = 3, the number of trips completed by each bus are [3,1,1]. The total number of trips completed is 3 + 1 + 1 = 5. So the minimum time needed for all buses to complete at least 5 trips is 3. ``` **Example 2:** ``` **Input:** time = [2], totalTrips = 1 **Output:** 2 **Explanation:** There is only one bus, and it will complete its first trip at t = 2. So the minimum time needed to complete 1 trip is 2. ``` **Constraints:** `1 <= time.length <= 105` `1 <= time[i], totalTrips <= 107`",8 "test_case": [9 {10 "label": "Example 1",11 "input": "time = [1,2,3], totalTrips = 5",12 "output": "3 "13 },14 {15 "label": "Example 2",16 "input": "time = [2], totalTrips = 1",17 "output": "2 "18 }19 ],20 "constraints": [21 "1 <= time.length <= 105",22 "1 <= time[i], totalTrips <= 107"23 ],24 "python_template": "class Solution(object):\n def minimumTime(self, time, totalTrips):\n \"\"\"\n :type time: List[int]\n :type totalTrips: int\n :rtype: int\n \"\"\"\n ",25 "java_template": "class Solution {\n public long minimumTime(int[] time, int totalTrips) {\n \n }\n}",26 "metadata": {27 "func_name": "minimumTime"28 }29}