Bit Manipulation Interview Questions

Bitwise ops, masks, and constant-space tricks.

75 problems

#Title
136Single Number
137Single Number II
190Reverse Bits
191Number of 1 Bits
201Bitwise AND of Numbers Range
231Power of Two
260Single Number III
268Missing Number
318Maximum Product of Word Lengths
342Power of Four
371Sum of Two Integers
389Find the Difference
393UTF-8 Validation
401Binary Watch
411Minimum Unique Word Abbreviation
421Maximum XOR of Two Numbers in an Array
461Hamming Distance
476Number Complement
477Total Hamming Distance
645Set Mismatch
693Binary Number with Alternating Bits
762Prime Number of Set Bits in Binary Representation
868Binary Gap
898Bitwise ORs of Subarrays
1310XOR Queries of a Subarray
1318Minimum Flips to Make a OR b Equal to c
1342Number of Steps to Reduce a Number to Zero
1558Minimum Numbers of Function Calls to Make Target Array
1707Maximum XOR With an Element From Array
1720Decode XORed Array
1734Decode XORed Permutation
1829Maximum XOR for Each Query
2151Maximum Good People Based on Statements
2212Maximum Points in an Archery Competition
2220Minimum Bit Flips to Convert Number
2275Largest Combination With Bitwise AND Greater Than Zero
2317Maximum XOR After Operations
2397Maximum Rows Covered by Columns
2411Smallest Subarrays With Maximum Bitwise OR
2419Longest Subarray With Maximum Bitwise AND
2425Bitwise XOR of All Pairings
2429Minimize XOR
2505Bitwise OR of All Subsequence Sums
2527Find Xor-Beauty of Array
2595Number of Even and Odd Bits
2859Sum of Values at Indices With K Set Bits
2917Find the K-or of an Array
2932Maximum Strong Pair XOR I
2935Maximum Strong Pair XOR II
2980Check if Bitwise OR Has Trailing Zeros
2997Minimum Number of Operations to Make Array XOR Equal to K
3064Guess the Number Using Bitwise Questions I
3094Guess the Number Using Bitwise Questions II
3125Maximum Number That Makes Result of Bitwise AND Zero
3133Minimum Array End
3199Count Triplets with Even XOR Set Bits I
3215Count Triplets with Even XOR Set Bits II
3226Number of Bit Changes to Make Two Integers Equal
3289The Two Sneaky Numbers of Digitville
3304Find the K-th Character in String Game I
3307Find the K-th Character in String Game II
3314Construct the Minimum Bitwise Array I
3315Construct the Minimum Bitwise Array II
3344Maximum Sized Array
3370Smallest Number With All Set Bits
3566Partition Array into Two Equal Product Subsets
3632Subarrays with XOR at Least K
3646Next Special Palindrome Number
3702Longest Subsequence With Non-Zero Bitwise XOR
3750Minimum Number of Flips to Reverse Binary String
3766Minimum Operations to Make Binary Palindrome
3769Sort Integers by Binary Reflection
3782Last Remaining Integer After Alternating Deletion Operations
3827Count Monobit Integers
3950Exactly One Consecutive Set Bits Pair