Optimal Assignment with Bitmask DP

hard
Unit 21 · Dynamic Programming III0/0 to milestone

Assign n workers to n tasks, one each, minimising total cost. Trying all n! permutations is hopeless beyond n ≈ 10, but bitmask DP solves it in O(n² · 2ⁿ):

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Optimal Assignment with Bitmask DP · TechGradify