This is a verified interview question from Uber. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Uber Order Fulfillment - Uber Online Assessment IIT Roorkee" covers key patterns like DP.
"### Problem Uber receives N delivery requests. For each request: - cost[i] represents the cost of assigning a courier to fulfill the request. - hubA[i] is 1 if the request can be fulfilled by Hub A, otherwise 0. - hubB[i] is 1 if the request can be fulfilled by Hub B, otherwise 0. To maintain operational efficiency, Uber requires that: - Hub A should be assigned more than K selected requests. - Hub B should also be assigned more than K selected requests. A request that can be served by both hubs contributes to the count of both hubs if it is selected. Choose a subset of requests that satisfies the above requirements while minimizing the total assignment cost. If no valid subset exists, return -1. ### Input - N - cost1, cost2, ... costN - hubA1, hubA2, ... hubAN - hubB1, hubB2, ... hubBN - K ### Output Print the minimum total assignment cost, or -1 if no feasible selection exists."
Join thousands of developers practicing for Uber.