You are given an integer array jobs, where jobs[i] is the amount of time it takes to complete the ith job.
There are k workers that you can assign jobs to. Each job should be assigned to exactly one worker. The working time of a worker is the sum of the time it takes to complete all jobs assigned to them. Your goal is to devise an optimal assignment such that the maximum working time of any worker is minimized.
Return the minimum possible maximum working time of any assignment.
Example 1:
Input: jobs = [3,2,3], k = 3
Output: 3
Explanation: By assigning each person one job, the maximum time is 3.
Example 2:
Input: jobs = [1,2,4,7,8], k = 2
Output: 11
Explanation: Assign the jobs the following way:
Worker 1: 1, 2, 8 (working time = 1 + 2 + 8 = 11)
Worker 2: 4, 7 (working time = 4 + 7 = 11)
The maximum working time is 11.
Constraints:
1 <= k <= jobs.length <= 121 <= jobs[i] <= 10^7jobs 의 작업 시간의 총 합을 구한다.
한 명의 작업자에게 모든 작업이 할당된 경우로써 최대 시간으로 가정할 수 있다.
각 작업자가 할당 받는 작업 중 가장 긴 작업 시간이다.
DFS는 모든 경우의 수를 탐색하지만,
BackTracking은 **더 이상의 계산이 불필요한 경우 멈추고 뒤로 돌아가는 ‘가지치기’**를 한다!
일반적인 DFS를 사용해서 완전 탐색을 해야 할 때가 있기 때문에 무조건 BackTracking이 좋은건 아니다.