---
# System prepended metadata

title: 2895. Minimum Processing Time
tags: [Leetcode, Medium, Greedy]

---

Link: https://leetcode.com/problems/minimum-processing-time/description/
## 思路
每个processor要处理4个任务 那么对于每个processor而言 processingTime就是开始时间+最长的task时间
如果想要找minimum processing time就只要把最早开始的processor匹配上最长的任务就可以了
所以tasks倒序排列 processorTime正序排列
然后找到所有processor里面处理时间最长的就可以了
## Code
```python=
class Solution:
    def minProcessingTime(self, processorTime: List[int], tasks: List[int]) -> int:
        tasks.sort(reverse = True)
        processorTime.sort()
        ans = processorTime[0]+tasks[0]
        for i in range(len(processorTime)):
            ans = max(ans, processorTime[i]+tasks[4*i])
        return ans
```