---
# System prepended metadata

title: 2323. Find Minimum Time to Finish All Jobs II
tags: [Leetcode, Sorting, Medium, Greedy]

---

# 2323. Find Minimum Time to Finish All Jobs II
###### tags: `Leetcode` `Medium` `Greedy` `Sorting`
Link: https://leetcode.com/problems/find-minimum-time-to-finish-all-jobs-ii/description/
## 思路
longest task给fastest person
因此排序两个array
jobs[i]给workers[i]
所花的时间是jobs[i]/workers[i]向上取整 
因此用```(jobs[i]+workers[i]-1)/workers[i]```
## Code
```java=
class Solution {
    public int minimumTime(int[] jobs, int[] workers) {
        int n = jobs.length;
        int ans = 0;
        Arrays.sort(jobs);
        Arrays.sort(workers);
        for(int i=0; i<n; i++){
            ans = Math.max(ans, (jobs[i]+workers[i]-1)/workers[i]);
        }
        return ans;
    }
}
```