Minimum Time to Publish Comic Books
Updated
Problem statement
A publisher has to produce comics comic books. It has printTimes.length printing machines and bindingMachines binding machines. Printing machine i needs printTimes[i] minutes to print all pages of one comic. Every binding machine needs bindTime minutes to bind all pages of one comic. At any moment, each machine works on the pages of at most one comic.
Each comic goes through these steps in order:
- A printing machine
ithat is free starts printing the comic. - After
printTimes[i]minutes, the printed pages come out of that machine. - After waiting any amount of time, possibly zero, the pages go into a binding machine that is free.
- After
bindTimeminutes, the bound comic comes out and is done.
Putting pages into a machine or taking them out takes no time. All machines are free at time 0.
Return the minimum time, in minutes, by which all comics comic books can be done.
Function
minPublishTime(comics: int, bindingMachines: int, bindTime: int, printTimes: int[]) → longExamples
Example 1
comics = 2bindingMachines = 1bindTime = 34printTimes = [1100]return = 2234There is one printer and one binder.
- The first comic is printed during
[0, 1100]and bound during[1100, 1134]. - The second comic is printed during
[1100, 2200]and bound during[2200, 2234].
All comics are done at 2234.
Example 2
comics = 2bindingMachines = 2bindTime = 10printTimes = [10,16,1]return = 12Printer 2 needs only 1 minute per comic, so it prints both comics: the first during [0, 1] and the second during [1, 2].
- The first comic goes to one binder and is bound during
[1, 11]. - The second comic goes to the other binder and is bound during
[2, 12].
All comics are done at 12. If printer 0 printed the second comic instead, its printing would end at 10 and its binding at 20.
Example 3
comics = 3bindingMachines = 2bindTime = 5printTimes = [5,7]return = 15- The first comic is printed on printer
0during[0, 5]and bound during[5, 10]. - The second comic is printed on printer
1during[0, 7]and bound during[7, 12]. - The third comic is printed on printer
0during[5, 10]and bound during[10, 15], on the binder that the first comic freed at10.
All comics are done at 15.
Constraints
1 <= comics <= 10^61 <= printTimes.length <= 10^51 <= bindingMachines <= 10^91 <= bindTime <= 10^91 <= printTimes[i] <= 10^9
More Nutanix Online Assessment questions
- Good SubsequencesOA · Seen Jul 2026
- Min Cost to Connect All PointsOA · Seen Jun 2026
- Digit Changes for a Multiple of 9OA · Seen Aug 2025
- Gas Station Loop StartOA · Seen Aug 2025
- Number of Players (for MTS2)OA · Seen Oct 2024
- Work Schedules (for MTS2)OA · Seen Oct 2024
- Minimum Operations to Convert ArrayOA · Seen Apr 2024
- No Adjacent CharactersOA · Seen Apr 2024
- Build a BST From a ListOA · Seen Nov 2022
- Delete Even-Valued Nodes From a Linked ListOA · Seen Nov 2022
Similar questions at other companies
- Initial Public OfferingPoint72 · OAPoint72 interview questions
- Find Minimum TimeRippling · OARippling interview questions
- Maximum Quality SumAmazon · OA
- Minimum Days to Target EngagementTikTok · OATikTok interview questions
- Job ExecutionSnowflake · OASnowflake interview questions
- Maximizing Difference in Array Elements with Moves 🐹Microsoft · OAMicrosoft interview questions
- Job ExecutionAdobe · OAAdobe interview questions
- Find Minimum TimeAlphaSense · OA
- Find Minimum TimeBlackRock · OABlackRock interview questions
- Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions