Trick | Difficulty | |
---|---|---|

LC 1386. Cinema Seat Allocation | Pure Bit Manipulation | 3-4 points |

LC 1452. People Whose List of Favorite Companies Is Not a Subset of Another List | Pure Bit Manipulation | 3-4 points |

# Category: Bit Manipulation

## Bit Manipulation Tricks

Summary Bit manipulation is all about tricks. bitset is also a common data structure in set problems. Details Bitwise Not Flip Last Set Bit The last set bit is the rightmost set bit. i&(i-1) does the trick to reset that bit. It is commonly used in Binary Indexed Tree (BIT). (i-1) flips all the bits…

## Pure Bit Manipulation

Summary In this post, I will introduce problems related to bit manipulation. Before that, you may want to learn the std::bitset<> class template. Detials LC 1386. Cinema Seat Allocation The problem is not difficult. But it is tricky to write a clean code. The hint is that all valid patterns can be presented by the…