Loading
Loading
A batch processor must clear a list of job sizes within a fixed number of hours. In each hour it can process up to a chosen throughput, and it works on only one job per hour — a job smaller than the throughput still occupies the whole hour.
Return the smallest throughput that clears every job within the deadline.
jobs = [3, 6, 7, 11], hours = 8throughput 41 + 2 + 2 + 3 = 8 hours — fitsthroughput 31 + 2 + 3 + 4 = 10 hours — too slow4Sign in to keep a note here. It is free, and nobody else can see it.
Sign inExample 1
Sign in to open hints.
Struggling is where the learning happens. Open this once you have genuinely tried, or once the hints have run out.
O(n log M) time · O(1) space
Input. Run your code to watch it work on this input, one line at a time.
Running code is turned off on this deployment. You can still read the problem, write code, use hints and the visualizer.
Tab moves focus out of the editor. Press Ctrl+M to let Tab indent instead.
No results yet
Run your code against the sample tests, or submit to run the full suite.
Example 2
One job per hour, so the throughput must cover the largest.
Example 3