The AND bitwise operation takes two sets of bits and for each pair of bits (the two bits at the same index in each set) returns 1 if both bits are 1. Otherwise, it returns 0.
Think of it like a hose with two knobs. Both knobs must be set to on for water to come out.
When performing AND on two integers, only the digit columns shared by both integers remain:
Pass Your Interviews with My FREE 7-Day Crash Course
I'll teach you the right way of thinking for breaking down tricky algorithmic coding interview questions you've never seen before.
No prior computer science training necessary—I'll get you up to speed quickly, skipping all the overly academic stuff.
No spam. One-click unsubscribe if you hate it.