Binary Representation
Everything on SkillVeris tagged Binary Representation — collected across the glossary, study notes, blog, and cheat sheets.
3 resources across 1 library
Interview Questions(3)
What Are the Core Bit Manipulation Operators and When Do You Use Them?
Bit manipulation uses the six operators AND (&), OR (|), XOR (^), NOT (~), left shift (<<), and right shift (>>) to inspect, set, clear, or toggle individual b…
How Does the XOR Swap Technique Work, and Should You Actually Use It?
The XOR swap swaps two integer variables without a temporary variable by applying a = a ^ b, then b = a ^ b, then a = a ^ b, exploiting that XOR-ing a value wi…
How Do You Count the Number of Set Bits in an Integer Efficiently?
The fastest general technique counts set bits in O(k) time, where k is the number of set bits, using Brian Kernighan’s trick: repeatedly apply n = n & (n - 1),…