Maximize Pages Before Suspension
The engineering team at an Amazon fulfillment center is optimizing their performance system where each printer can print pages/number of pages.
Each printer can be in exactly one of three states: operational, idle, or suspended.
Suspension Rule: If there are at least x operational printers, all such printers i (with threshold[i] < x) will get suspended and stop printing.
Task: The goal is to determine the maximum number of pages that can be printed before printers get suspended.
Note:
threshold[i] = x allows it to print pages[i] pages. However, once at least x printers are active, their pages gets printed first, and then all printers with threshold <= x will get suspended immediatelyFastPrep extends its boundless thanks to the incredible friend who so generously shared the source! 🧡
1Example 1
2Example 2
3Example 3
Constraints
Limits and guarantees your solution can rely on.
🐣