AND, OR, XOR & Shifts
Read and combine bits with confidence.
Bits Are Your Toolkit
Every integer is really a row of bits, just 0s and 1s. Learning to read and combine them gives you fast, clever tricks in contests. 🔧
See the Binary
Use Python's bin() to peek at the bits of any number. The 0b prefix just marks it as binary, the rest is the bit pattern.
print(bin(13)) # 0b1101All lessons in this course
- AND, OR, XOR & Shifts
- Set, Clear & Toggle a Bit
- Count Bits and Lowest Set Bit
- Bitmasks as Tiny Sets