Minimum Robot and Human Fulfillment Time
Updated
Problem statement
An Amazon fulfillment center must process n orders. Order i must be assigned entirely to exactly one of two processing sides:
- The automated robotics system processes all orders assigned to it in parallel. If it receives at least one order, its elapsed time is the maximum
robotTime[i]among those orders. - The human workforce processes all orders assigned to it one by one. Its elapsed time is the sum of
humanTime[i]across those orders.
The two sides work concurrently, so the elapsed time for an assignment is the maximum of the robotics-system time and the human-workforce time. For this exercise, an unused side contributes 0 hours.
Return the minimum possible elapsed time needed to process and dispatch every order.
Function
minimumFulfillmentTime(humanTime: long[], robotTime: long[]) → longExamples
Example 1
humanTime = [9, 6, 8, 6, 4, 4]robotTime = [4, 3, 7, 7, 9, 8]return = 8Assign the order with robotics time 9 and human time 4 to the human workforce, and assign every other order to the robotics system. The human side takes 4 hours, while the robot side takes 8 hours, so all orders finish in 8 hours.
No assignment can finish in 7 hours because both orders with robotics times above 7 would have to be handled by humans, requiring 4 + 4 = 8 hours.
Example 2
humanTime = [2, 3]robotTime = [10, 10]return = 5Assign both orders to the human workforce. The human side takes 2 + 3 = 5 hours, and the unused robot side contributes 0 hours.
Constraints
1 <= humanTime.length = robotTime.length <= 2 * 10^51 <= humanTime[i], robotTime[i] <= 10^9- All sums and the returned result fit in a signed
64-bitinteger.
More Amazon Online Assessment questions
- Lexicographically Largest IdentifierOA · Seen Nov 2026
- Maximize Shipment Order by Sorting One WindowOA · Seen Nov 2026
- Top K Frequent ElementsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fill One Exact-Length Binary WindowOA · Seen Nov 2026
- Minimum Grid InconvenienceOA · Seen Nov 2026
- Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026
- Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Get Smallest Base SegmentOA · Seen Nov 2026
- Minimum Cost of Left and Right PropagationOA · Seen Nov 2026
- Maximum Equal-Bit Pairs in a SubsequenceOA · Seen Nov 2026
Similar questions at other companies
- Capacity to Ship Packages Within DaysMicrosoft · OA · ONSITE INTERVIEWMicrosoft interview questions
- Rock JumpingIMC Trading · OAIMC Trading interview questions
- Minimize Maximum Group DifferenceDRW · OADRW interview questions
- Array NullificationQRT · OA
- Minimum-Cost Solar Rooftop AllocationDeloitte · OADeloitte interview questions
- Three-Part Partition with Minimum Largest RangeLSEG · OALSEG interview questions
- K-Means ClusteringAtlassian · OAAtlassian interview questions
- Get Minimum Development TimeSalesforce · OASalesforce interview questions
- Job ExecutionMathWorks · OAMathWorks interview questions
- Police Station 🚓The D.E. Shaw Group · OAThe D.E. Shaw Group interview questions