Fewest Drivers Whose Vehicle Capabilities Cover an Event Request
Last updated: November 29, 2026
Quick Overview
An event needs a set of up to 16 vehicle capabilities (XL, wheelchair access, child seat, pet friendly, and so on). Each available driver offers a subset. Return the minimum number of drivers whose combined capabilities cover all required ones, or -1 if impossible.
Uber
November 29, 20260
0
0 solved
An event needs a set of up to 16 vehicle capabilities (XL, wheelchair access, child seat, pet friendly, and so on). Each available driver offers a subset. Return the minimum number of drivers whose combined capabilities cover all required ones, or -1 if impossible.
Framed around Uber for Business event bookings, this is a classic Uber onsite pattern: small universe, many candidates, so bitmask DP is the intended tool. The interviewer checks that you compress capabilities to bits and keep the state space at $2^k$.
What the Interviewer Expects
- Maps capability names to bit positions
- Ignores capabilities that are not required
- Uses a DP or BFS over 2^k coverage states
- Deduplicates identical driver masks to cut work
- Returns -1 when the union of all drivers misses a requirement
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you also return which drivers were picked?
- What if drivers have different costs and you minimize total cost?
- What if k grows to 60 capabilities?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: required (list of up to 16 capability strings) and drivers (list of lists of strings). Output: minimum driver count, 0 if nothing is required, -1 if impossible. General set cover is NP-hard...
High-Level Design
Assign each required capability a bit. Convert each driver to a mask of only the required capabilities they have, drop zero masks, and deduplicate. Run BFS where a state is the covered mask: from mask...