Bits and maths interview questions

XOR, masks and shifts, counting 1 bits, and the modular arithmetic that keeps big counts manageable.

5 quick facts

– interview-ready · 6 questions in this topic

– of 6 tried

Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.

Questions

  1. The one value without a partnerPredict
  2. Count the 1 bits in a numberPredict
  3. 1-bit counts for every number from 0 to nPredict
  4. Which ticket from 0 to n is absent?Predict
  5. Bit tricks worth knowingPredict
  6. Working modulo 10⁹ + 7Predict

Practise this topic

Flashcards · 16

Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.

Quick quiz · 6 questions

One exercise per question, checked as you go. Needs JavaScript.

Mock interview · 1 set

Timed, out loud, then tick what you covered. Needs JavaScript.

Quick facts

Recall the answer first, then tap Show to check.

Sources: Topic outline informed by the Tech Interview Handbook by Yangshun Tay and the NeetCode 150 pattern grouping by neetcode-gh, both MIT licensed. Every problem, solution and explanation is written by Best Latest Apps. Credits and license