Bitwise AND of two numbers

Easy
5 views 23 Jan 2026
Task: return a & b....

Check odd using bit operator

Easy
4 views 23 Jan 2026
Task: return true if x is odd using bitwise operator....

Swap using XOR

Easy
6 views 23 Jan 2026
Task: swap a[i] and a[j] using XOR (only if i!=j)....

Set k-th bit

Easy
5 views 23 Jan 2026
Task: set k-th bit (0-indexed) in x and return result....

Clear k-th bit

Easy
5 views 23 Jan 2026
Task: clear k-th bit (0-indexed) in x and return result....

Toggle k-th bit

Medium
7 views 23 Jan 2026
Task: toggle k-th bit and return result....

Extract lowest set bit

Medium
7 views 23 Jan 2026
Task: return lowest set bit value (like x & -x). If x==0 return 0....

Count bits using Kernighan

Medium
5 views 23 Jan 2026
Task: count set bits using x &= (x-1) loop....

Check if kth bit is set

Medium
6 views 23 Jan 2026
Task: return true if k-th bit is set....

Build mask between l..r

Medium
4 views 23 Jan 2026
Task: create bitmask with bits l..r set (inclusive)....

Reverse bits in 32-bit int

Hard
5 views 23 Jan 2026
Task: reverse bits of int and return result....

Find single number (others twice)

Hard
5 views 23 Jan 2026
Task: in array where every number appears twice except one, return the single number using XOR....

Find two single numbers

Hard
5 views 23 Jan 2026
Task: every number appears twice except two numbers. Return the two unique numbers....

Subset check using bitmask

Hard
6 views 23 Jan 2026
Task: given masks a and b, return true if b is subset of a (all bits in b also set in a)....

Compute parity bit

Hard
6 views 23 Jan 2026
Task: return 0 if number of set bits is even, 1 if odd....