DP with Bitmasks

Bitwise operations and Bitmasks

Tutorials

  1. Go through this CF blog for an idea of the bitwise operations and the concept of bitmasks.

  2. Go through this CF blog for understanding __builtin_popcount() function and bitsets

Session slides

  1. Part 1 - Bitwise Operations and their applications, preventing overflows when using left shift, Bitmasks. The youtube stream in which these topics were discussed can be found here

Practice problems

  1. Hackerrank - Counter Game
  2. Hackerrank - Lovely Integer
  3. Hackerrank - XOR Sequence
  4. Hackerrank AND product
  5. Hackerrank - SUM vs XOR
  6. Hackerrank - Flipping Bits
  7. Hackerrank - Sansa and XOR
  8. 1097/B - Petr and a Combination Lock

DP with bitmasking

Tutorials

  1. Learn the algorithm for iterating through all the submasks of a mask from this article of cp-algorithms

  2. Go through this article on hackerearth for understanding DP with bitmasks.

Session slides

  1. Part 2 - DP with bitmasks. The youtube stream in which these topics were discussed can be found here

Practice problems

  1. SPOJ - ASSIGN
  2. Atcoder DP - U (Grouping)
  3. Hackerearth - Mehta and tricky triplets
  4. Leetcode - Number of ways to wear different hats to each other
  5. Hackerrank - Synchronous shopping
  6. 1043/F - Make It One