Minimum Cost to Staff Every Project Role From the Bench

Last updated: November 29, 2026

Quick Overview

An engagement needs m distinct roles (m up to about 15) and there are n bench consultants, each with a cost for each role they are qualified for. Assign one consultant per role, each consultant to at most one role, minimizing total cost, or return -1 if impossible.

Accenture
Coding & Algorithms
Software Engineer
Accenture
November 29, 2026
Software Engineer
Online Assessment
Coding & Algorithms
Hard

0

0

0 solved


An engagement needs m distinct roles (m up to about 15) and there are n bench consultants, each with a cost for each role they are qualified for. Assign one consultant per role, each consultant to at most one role, minimizing total cost, or return -1 if impossible.

Staffing from the bench is a core operational problem at a firm that bills by consultant time. Harder Accenture assessment problems reward recognizing a small dimension that unlocks bitmask dynamic programming, and stating when Hungarian algorithm would be the better tool.

What the Interviewer Expects
  • Notices the small number of roles and proposes bitmask DP
  • Defines state clearly as the set of filled roles after considering a prefix of consultants
  • Lets a consultant stay on the bench
  • Handles unqualified pairs and infeasibility
  • States complexity and compares with the Hungarian algorithm
Key Topics to Cover
Bitmask DP
Assignment problem
Hungarian algorithm
Combinatorial optimization
Feasibility checks
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 solve it when m is 200?
  • Some roles need two consultants. How does the state change?
  • How would you add a constraint that at least one senior consultant is on the team?
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

cost[i][j] is the cost of consultant i in role j, or None if not qualified. Every role must be filled exactly once, consultants used at most once, n may exceed m. Return the minimum total or -1....

High-Level Design

Brute force over permutations is factorial. Because m is small, encode which roles are filled as an m-bit mask. Process consultants one at a time: dp[mask] is the minimum cost to fill exactly the ro...


Submit Your Answer
Markdown supported

Related Questions