Study
Bit Manipulation Interview Prep Plan: 29 Reported Questions
TrueInterview
October 26, 2026 · 16 min read

As of 2026-10-26, TrueInterview's bank holds 29 bit manipulation questions reported at 12 big-tech companies, and 28 of them were last reported within the past 12 months. Counted by question, 13 carry a phone-screen report, 10 an onsite report and 9 an OA report. In our reading of the titles, the most-linked ones are applied problems rather than standalone bit hacks: some use a mask as search state, such as Meta's onsite question Maximum Unique Character Subset, and others use fixed-width arithmetic, such as OpenAI's phone-screen question IPv4 Address Iterator with CIDR Support. Prove and edge-test a short list of identities, then practise them inside those problems.
Disclosure: TrueInterview is an interview-preparation product and publishes this article. Facts about other products come from their public pages on the dates listed under Sources.
Which bit manipulation problems do big-tech candidates actually report?
Applied problems, led by four titles: Maximum Unique Character Subset at Meta with 17 write-ups, DAG Allow / Disallow Propagation at Snowflake with 7, Minimum Operations to Transform an Integer Using ±2^i Steps with 6, and IPv4 Address Iterator with CIDR Support at OpenAI with 4. None of them is the single-number XOR puzzle that generic lists open with, so start from these titles.
| Question | Filed under | Example report | Write-ups | Where the bits go (our read) | Practise |
|---|---|---|---|---|---|
| Maximum Unique Character Subset | Meta | Meta onsite, 2026-08 | 17 | One mask per item's character set; combine only disjoint masks | Maximum Unique Character Subset |
| DAG Allow / Disallow Propagation | Snowflake | Snowflake phone screen, 2026-09 | 7 | Going by the title, a set per node pushed along edges, where a mask makes each merge one OR | DAG Allow / Disallow Propagation |
| Minimum Operations to Transform an Integer Using ±2^i Steps | Microsoft, Google, Salesforce, Uber | Microsoft phone screen, 2026-10 | 6 | The integer's own bits are the state, read from the lowest set bit | ±2^i Steps |
| IPv4 Address Iterator with CIDR Support | OpenAI | OpenAI phone screen, 2026-05 | 4 | The address as a 32-bit integer, with the prefix length turned into a network mask | IPv4 Address Iterator with CIDR Support |
| Split Stay Booking | Airbnb | Airbnb phone screen, 2026-02 | 4 | Not clear from the title; read the full prompt | Split Stay Booking |
| Largest Group Sharing a Digit | Google OA, 2026-05 | 4 | Going by the title, a 10-bit digit mask per number | Largest Group Sharing a Digit | |
| Count Paths That Can Form a Palindrome in a Tree | Uber, Google | Uber OA, 2026-08 | 3 | A parity mask of characters on each root path, compared by XOR | Count Paths That Can Form a Palindrome in a Tree |
| Minimum Menu Order Cost I | Airbnb | 3 | Not clear from the title; read the full prompt | Minimum Menu Order Cost I |
The table reads as three skills. The first, sixth and seventh rows put a set into a mask and then search, group or count over masks. The third row works on the bits of a number directly. Our read of the fourth row is plain mask arithmetic on a fixed width, where an off-by-one in the prefix length is the easiest mistake to make.
By company, Google files the most bit manipulation questions with 6, Salesforce and Meta file 4 each, Uber, Microsoft, Apple and Amazon 3 each, and OpenAI, Snowflake and ByteDance 2 each. These counts are small, so use them to order practice for a target company, never to predict a loop. A sibling title, Minimum Operations to Reduce an Integer to 0, is filed under Uber, Google and Salesforce but has no linked write-ups yet. If your target is one of those three companies, practise both titles together.
Link counts measure write-ups that mention a question, not how often a company asks it. These are candidate-reported questions reconstructed for practice, not any company's official list.
Our take: the classic lists are useful as identity drills and weak as a target. One Techie Delight author's Medium write-up lists reversing the bits of an integer, checking for a power of 4 and finding a missing number. None of those titles appears among the most-linked questions above. Spend an evening on classics to learn the identities, then move your hours to the reported titles.
Which interview rounds include bit manipulation questions?
All three rounds: 13 questions carry a phone-screen report, 10 an onsite report and 9 an OA report, and one question can appear in more than one round. More questions show up in a phone screen than in an onsite, so build fluency with the identities before your first screen instead of in the week before the onsite.

The phone-screen titles sit in the table above. The OA side adds Amazon's Maximize Bitwise AND Under a Budget, last reported 2026-09. The onsite side adds ByteDance's Stickers to Spell Word (LeetCode 691), last reported 2026-08.
| Your next round | What the reported titles lean toward (our read) | Practise first |
|---|---|---|
| OA | Integer and digit masks under a counting or greedy step, timed | Largest Group Sharing a Digit, Maximize Bitwise AND Under a Budget |
| Phone screen | One identity applied inside a short, well-specified problem | ±2^i Steps, IPv4 Address Iterator with CIDR Support |
| Onsite | A mask as the state of a search or dynamic program | Maximum Unique Character Subset, Stickers to Spell Word |
For maximise-AND problems in general, one common approach builds the answer from the highest bit down and keeps a bit only if the remaining budget still pays for it, because one high bit outweighs every lower bit combined. Be ready to justify why a higher bit outweighs all lower bits before you write the loop.
Our take: if your next round is an OA or a phone screen, drill the identities plus one integer-transform problem. If it is an onsite, add the mask-as-state problems in the next section. If you save bit work for the onsite, the screen may reach it first.
What does bit manipulation combine with in reported questions?
Often another technique, which is why a hack list underprepares you. Besides the bit-manipulation tag on all 29, the coding questions carry greedy on 6, dynamic programming on 5, graphs on 4, and topological sort and backtracking on 2 each. Not every question has a second tag, but enough do that you should practise masks inside other algorithms.
The pairing changes by company. Salesforce's 4 questions include 3 also tagged greedy. Google's 6 include 2 tagged graphs and 1 tagged dynamic programming, and Meta's 4 include 1 tagged dynamic programming and 1 tagged graphs. None of Microsoft's 3 or Apple's 3 carries a greedy, dynamic programming, graph or string tag. For those two companies, practise their filed titles directly before the pairings below. Salesforce's greedy skew is the clearer signal, so a Salesforce candidate should practise greedy transforms on the bits of a number.
Two reported titles are the templates worth learning cold. TrueInterview's problem list tags Count Paths That Can Form a Palindrome in a Tree as bitmask with DFS, hashmap, palindromes and tree, and rates it hard. A path's letters can form a palindrome when at most one letter has an odd count, so store each node's root-path parity mask, and two nodes pair up when the XOR of their masks has zero or one set bit. A hash map of mask counts then checks each node against its own mask and every one-bit variant of it.
Stickers to Spell Word is the standard bitmask dynamic program: a mask records which target positions are already covered, and each sticker moves you from one mask to a larger one. Memoise on the mask, and the search space is bounded by the number of subsets of the target.
Our take: practise three pairings in this order: mask plus greedy, mask plus dynamic programming, mask plus graph search. Each one changes what the mask stands for, and naming that meaning before you code is what makes the rest of the answer readable.
Which bit identities should you prove first?
Prove the identities in this order: single-bit masks, clearing the lowest set bit, isolating it, XOR pairing and subset masks. In our reading of the titles, each identity maps to one of the problems above, so proving them takes an afternoon and leaves your remaining hours for applied problems.
| Identity | Source | Edge case to test | Where it shows up (our read) |
|---|---|---|---|
| Read, set, clear or toggle bit k with a 1 << k mask | GeeksforGeeks' guide | k at or beyond the width | CIDR prefix masks |
| x & (x-1) clears the lowest set bit | GeeksforGeeks' guide | x = 0, and the power-of-two test | Counting set bits in character masks |
| x & -x isolates the lowest set bit | GeeksforGeeks' guide | x = 0, and the lowest negative value | Integer transforms by powers of two |
| XOR pairing: a ^ a = 0 and a ^ 0 = a | GeeksforGeeks' guide | Values that do not appear exactly twice | Parity masks on tree paths |
| Subset masks: two sets are disjoint when their AND is empty | Our read | The empty mask | Character subsets, sticker coverage |
GeeksforGeeks' guide describes checking bit k with n & (1 << k) and clearing it with the mask ~(1 << k). PracHub's guide says x & (x-1) clears the lowest set bit and x & -x isolates it under two's complement, with x = 0 handled separately when the result is used as an index or divisor. The same guide notes that the power-of-two test needs an x > 0 guard, because zero otherwise passes the bit part, and GeeksforGeeks' guide makes the same point.
The proof of the third identity is one line once you know the complement rule. GeeksforGeeks' guide states that ~x equals -(x + 1) in two's complement, so -x is ~x + 1: the + 1 carries through the trailing ones of ~x, which are the trailing zeros of x, and stops at the position of x's lowest set bit, which is the only set bit the two values share.
For step 4, GeeksforGeeks' guide lists XOR as self-inverse, with 0 as identity, commutative and associative, and says it finds a unique element when every other element appears twice. PracHub's guide adds the limit: the pairing trick does not solve an arbitrary frequency problem, or tell two unpaired values apart, without more partition logic.
Our take: prove each identity on four-bit values before you rely on it. Wikipedia's two's complement article gives the 4-bit range as -8 to +7, which is small enough to check every input by hand, including the lowest negative.
How should you handle width, sign and language differences?
State the integer contract before you code: width, signedness, shift rules and overflow. PracHub's guide says bit answers are "easy to get almost right" because the reasoning assumes a finite row of bits. The CIDR iterator in the first table is a prompt where an unstated width changes the answer, and in our read the power-of-two steps question may be another.
PracHub's guide advises stating width, signedness, shift rules and overflow behaviour before using any trick, and asking whether left shift discards high bits, throws or grows the integer.
| Language | What to say before you code | Source |
|---|---|---|
| Python | Integers have unlimited precision, so a 32-bit answer needs an explicit mask | Python's documentation; PracHub's guide on masking 32-bit unsigned prompts |
| Python | Bitwise results behave as if there were infinite sign bits, so ~5 == -6 | PracHub's guide |
| Python | For a 32-bit logical right shift, mask with 0xffffffff first, then shift | PracHub's guide |
| Java | >>> shifts a zero into the top bit, while >> sign-extends | Oracle's Java tutorial |
| C++ | Unsigned arithmetic wraps modulo 2^n, so UINT_MAX + 1 gives 0 | cppreference |
| C++ | Signed overflow is undefined behaviour | cppreference |
The lowest negative value deserves its own test. Wikipedia's two's complement article notes the exception when reversing the sign: the lowest negative value. In a fixed-width signed type, x & -x on that value negates a number with no positive counterpart, and in C++ that negation is signed overflow, which cppreference lists as undefined behaviour.
Our take: add a short contract statement to your interview script and say it before the first line of code: the width, whether the input is signed, which shift you will use, and what happens on overflow in your language. In Python, say that you will mask after every operation that can grow the value. That statement is part of the answer, and it is where an almost-right solution becomes a correct one.
Which bit tricks are overrated?
XOR swap, hand-rolled popcount and unmeasured speed claims. PracHub's guide says "Swapping with XOR is usually worse than a temporary variable" because it is harder to read and can zero a value when two aliases refer to the same storage. Oracle's Two-Value Exchange Warm-Up, reported in an onsite and last reported 2026-08, shows the swap still comes up, so know it and explain the trade-off.
For population count, PracHub's guide advises using the language's standard intrinsic unless the interviewer asks for the algorithm, and explaining Kernighan's loop to show understanding. One Techie Delight author's Medium write-up says bit manipulation can give speed-ups but makes the code more difficult to write and maintain.
Our take: in an interview, clarity wins over the trick. Use a temporary variable, call the built-in popcount, and reach for an XOR identity only when you can state the invariant it relies on. If the interviewer asks for the trick, show it as a second version and explain the trade-off.
How would you approach Maximum Unique Character Subset?
Read the full prompt first, then treat it as a search over disjoint character masks. It was reported in Meta's onsite, last in 2026-08, and it is the most-linked title in the first table. We do not know its statement beyond the title, so the steps below assume the task is choosing items whose characters do not overlap.
- Convert each item to a mask with one bit per letter. A lowercase alphabet fits in one machine word, so say that width out loud.
- Test an item that repeats a character before anything else: if the prompt requires unique characters, such an item can never join a set, and building its mask silently hides the repeat.
- Start the search from the empty mask, and combine an item only when the AND of the two masks is zero.
- Carry mask_a | mask_b as the search state, and count the result with the language's popcount.
- If the prompt asks for the best total, memoise on the mask or prune branches that cannot beat the current best, and say which one you chose and why.
The same habits carry to the power-of-two steps question, where the integer's own bits are the state. If the allowed step is adding or subtracting a power of two, read the number from its lowest set bit with x & -x: a single set bit costs one subtraction, while for a run of set bits, adding the low bit turns the run into one carry and never costs more than subtracting each bit. It is strictly cheaper for runs of three or more, or when the carry merges into the next run up. Write that rule, prove it on a four-bit value, and test zero and the largest value in your width.
What changes at senior and staff level?
Less than the new-grad label suggests. By the levels candidates reported, write-ups link these questions 28 times from senior-or-above candidates and 32 times from junior-or-below candidates. Maximum Unique Character Subset skews senior, with 13 senior-or-above links, 1 of them staff-plus or manager, against 4 from junior-or-below candidates. Our read: senior candidates should prepare for bit work, and in the most-linked title it sits inside a larger search.
The other splits are mixed. DAG Allow / Disallow Propagation at 4 senior-or-above links against 3 and Split Stay Booking at 3 against 1 lean senior, while IPv4 Address Iterator with CIDR Support is even at 2 against 2. At the other end, Count Paths That Can Form a Palindrome in a Tree has no senior-or-above links among its 3, and the ±2^i question has 1 of 6. Maximum Unique Character Subset alone supplies 13 of the 28 senior-or-above links, so the senior skew sits mostly in one title. Across topics, backtracking links lean senior at 13 against 5, and sorting at 8 against 4. These are write-up links by self-reported level, not counts of people.
Our take: at senior level the mask is a means to an algorithmic end. The signal is how cleanly you choose the state, how early you state the integer contract and how you test the boundaries. Our suggestion, not a reported pattern: be ready for follow-ups on the design of the state, such as why a mask instead of a set, what the width limit is, and what changes if the alphabet grows past one machine word.
Down-leveling note (our view): in a coding round, the part of a bit answer most likely to show senior judgement is the integer contract and the boundary tests, so treat them as part of the answer rather than as polish.
How we counted
Counts come from TrueInterview's question bank as of 2026-10-26 and cover questions tagged bit manipulation and filed under big-tech companies. A question can be filed under several companies and reported in several rounds, so tallies overlap. Write-up links count candidate reports, split by the level each candidate gave, and say nothing about how often a company asks a question.
FAQ
How do I solve a bit manipulation problem step by step?
Start with the contract: width, signedness and the shift you will use, as PracHub's guide advises. Next, write a four-bit example and decide what each bit stands for, whether that is a character, a digit, a node's state or the number itself. Then pick the identity that matches the operation you need, such as a disjointness check, clearing the lowest bit or XOR pairing. Finish by testing zero, the largest value in your width and, for signed inputs, the lowest negative value.
Are bit manipulation questions asked of experienced candidates?
Yes. The level split in the senior section shows write-up links from senior-or-above candidates close to those from junior-or-below candidates, and the most-linked question leans senior. Our view is that experienced candidates should prepare bit work as the state inside a search, a dynamic program or a graph problem, since the most-linked senior-leaning title uses masks that way in our reading. Prepare the identities quickly and spend the rest of your time on the applied titles listed above.
What should I know about bit manipulation in C and C++?
Three rules cover most interview traps. cppreference says integral operands of built-in arithmetic operators undergo integral promotion first, so ~ applied to an unsigned char produces an int with its high bits set; cast back or mask the result. Wikipedia's two's complement article says C++20 and C23 require two's complement representation, which makes x & -x well defined for values other than the lowest negative. Use unsigned types whenever the prompt describes raw bits.
Do I need the two non-repeating elements trick?
Learn it as an exercise in x & -x, not as a likely question. GeeksforGeeks' guide explains it as XORing every element, taking the rightmost set bit of the result, and splitting the elements into two groups that you XOR separately. One Techie Delight author's write-up lists the related problem of finding two odd-occurring elements without extra space. Neither appears among the reported titles above, so give it one session and move on.
Your practice plan
A three-week plan for someone working full time, at about an hour a day:
- First week, the identities. Write and prove the five identities on four-bit values, then write width-safe helpers in your interview language, including a width mask for Python.
- First week, integer transforms. Solve Minimum Operations to Transform an Integer Using ±2^i Steps and Minimum Operations to Reduce an Integer to 0, both filed under Uber, Google and Salesforce, and prove the run-of-ones rule before you code it.
- First week, fixed-width masks. Build OpenAI's phone-screen question IPv4 Address Iterator with CIDR Support and test the shortest and longest prefix lengths, then time yourself on Largest Group Sharing a Digit as OA practice.
- Second week, masks as search state. Solve Maximum Unique Character Subset with the steps above, then Stickers to Spell Word as a bitmask dynamic program.
- Second week, masks with graphs. Work DAG Allow / Disallow Propagation in topological order and Count Paths That Can Form a Palindrome in a Tree with parity masks.
- Third week, your target company. For Amazon, add Maximize Bitwise AND Under a Budget; for Oracle, Two-Value Exchange Warm-Up with the swap trade-off spoken aloud; for Airbnb, Split Stay Booking. Then work through your company's remaining filed questions in the question bank.
- Throughout, check against the tests. TrueInterview says coding questions are judged on hidden tests that show the case you failed; re-run any problem where a hidden test caught zero, a sign boundary or an off-by-one in the width.
Sources
- TrueInterview question bank — bit manipulation at big-tech companies — counted 2026-10-26
- Coding Interview Questions by Company · TrueInterview — checked 2026-10-26
- Medium — checked 2026-10-26
- Bit Manipulation Interview Questions - GeeksforGeeks — checked 2026-10-26
- Bit Manipulation Interview Questions: Signed Values, Masks, and Proofs | PracHub Knowledge Hub — checked 2026-10-26
- Two's complement - Wikipedia — checked 2026-10-26
- Built-in Types — Python 3.15.2 documentation — checked 2026-10-26
- Bitwise and Bit Shift Operators (The Java™ Tutorials > Learning the Java Language > Language Basics) — checked 2026-10-26
- Arithmetic operators - cppreference.com — checked 2026-10-26
- Interview prep compared: your application, end to end · TrueInterview — checked 2026-10-26
Last reviewed: 2026-10-26.