Bit Manipulation Based

Asked atExpediaHashedIn
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
  1. 01Confirm value range, signedness, and frequency guarantees.
  2. 02Map each requirement to a bitwise property.
  3. 03Choose masks, XOR, shifts, or per-bit counts.
  4. 04State the bit invariant.
  5. 05Verify high-bit and zero cases.

Reference answer

Then expect these follow-ups

  • How do per-bit counts solve the thrice-except-once variant?

    Tests: constraint adaptation

  • When should you use a BitSet instead of an integer mask?

    Tests: follow-up reasoning

Hiring now

Expedia has 109 open roles right now

landed applies to roles like these for you, on each company’s own site, with answers written for the role.

Get 5x interviews10 free auto-applies. No card.
  • Software Development Engineer III - Platform Productivity Tools

    India - Gurgaon

  • Sr Manager, Software Engineering

    Austin Domain 11 - HomeAway

  • Software Development Engineer II

    India - Gurgaon

Or practice this question first

Next question