BTI Beyond The Interviews

DSA · 9 sections

Bit Manipulation

Bitwise tricks, masks, subset patterns, and the bit-hack gotchas that show up in interviews.

Premium · preview 101 cards Updated 24 Oct 2026
Free to preview. The first 3 cards and the full outline are below — the rest of this sheet is part of the DSA & Data Structures bundle.

What's inside

Preview — first 3 of 101 cards

Bitwise operators

`&` AND, `|` OR, `^` XOR, `~` NOT, `<<` left shift, `>>` right shift. Use parentheses; precedence surprises are common.

int a = x & y;   // AND
int b = x | y;   // OR
int c = x ^ y;   // XOR
int d = ~x;      // NOT

Truth tables

AND is 1 only if both 1. OR is 0 only if both 0. XOR is 1 if bits differ.

Left shift

`x << n` shifts bits left, filling zeros on the right; equals multiply by 2^n when no overflow. Unsigned wraps mod 2^n; since C++20 signed overflow is defined mod 2^N (see Left shift overflow).

98 more cards in this sheet

Unlock the DSA & Data Structures bundle — ₹399

One-time payment. Unlocks this sheet and 8 other sheets in the bundle, plus a typeset PDF of each.

Unlock the bundle See all bundles

Or get all 76 sheets for ₹999 — one payment, every future sheet included.