DDSA Solutions

Bitmask

1 problems · 0 with full explanations

0 Easy1 Medium0 Hard
Bitmask DP represents a subset of n items as a single integer (bit i = 1 means item i is included). Enables O(2ⁿ · n) DP over all subsets — practical up to n ≈ 20. Classic: Travelling Salesman, covering problems, and assignment problems.

How to practice

To practice Bitmask problems effectively, start with the Easy problems listed below, trace through each solution on paper, then re-implement without looking. When you can recognise the bitmask pattern within 30 seconds of reading a new problem, move on to Medium difficulty. Use the related topic pages and our study guide for a structured progression.

Open the full study guide →

All Bitmask problems