How do you find the missing number in an array?

Updated Apr 28, 2026

Short answer

Use sum formula or XOR.

Deep explanation

Expected sum minus actual sum gives missing number.

Real-world example

Missing ID detection.

Common mistakes

  • Overflow in large numbers.

Follow-up questions

  • Why XOR?
  • Time complexity?

More Arrays interview questions

View all →