Schedule Deliveries

Give a list of piers each with 4 receiving docks, and a list of intake delivery times, return the earliest time to complete all deliveries. 

Example
Input:
numOfPiers = 2
pierOpenTime = [7, 9]
deliveryTime = [7,6,3,4,1,1,2,0]

Output:
14

Explanation:
Assign the deliveries [2, 1, 6, 7] to pier 0 which opens at time 7.

The finishing time for pier 0 : 2 + 7 = 9, 1 + 7 = 8, 6 + 7 = 13, 7 + 7 = 14.

Assign the deliveries [3, 1, 4, 0] to pier 1 which opens at time 9.

The finishing time for pier 1 : 12, 10, 13, 9

The max finishing times is 14, which the earliest possible finish time.




Get one-to-one training from Google Facebook engineers

Top-notch Professionals

Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.

Customized Private Class

Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.