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
Coding & Algorithms
Software Engineer
Uber
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

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
Bitmask DP
Set cover
BFS over states
Hashing
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported