Find a lesson, question or project

Start typing to search published content and planned structures.

↑ ↓ moveEnter openEsc close
01 / WHAT IT SOLVES

Missing or unique-number problems whose input guarantees exact pairing.

02 / HOW TO RECOGNIZE IT
  • every value appears twice except one
  • numbers come from a known range
  • constant extra space
03 / PROTECT THIS INVARIANT

All matched values cancel regardless of processing order, while the unmatched value remains.

04 / EXPECTED COST

O(n) time. Typical auxiliary space: O(1).

JAVA STARTING POINT

A template to adapt, not memorize.

Java
int answer = 0;
for (int value : values) {
    answer ^= value;
}

Common mistakes

  • Using XOR without the required pairing guarantee
  • Forgetting expected range values
  • Treating XOR as addition

PUBLISHED / 01

Learn in this order.

Available articles always appear before the publishing plan.

PLANNED PRACTICE

What comes after the published lessons.

  1. Single numberPlanned, not yet published
  2. Find two unique numbersPlanned, not yet published