Find the Notification ID Delivered Once While Others Arrive Three Times

Last updated: November 29, 2026

Quick Overview

Due to at-least-once delivery, every push notification ID in a log appears exactly three times except one, which appears once. Return that ID using O(1) extra space.

Meta
Coding & Algorithms
Software Engineer
Meta
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Due to at-least-once delivery, every push notification ID in a log appears exactly three times except one, which appears once. Return that ID using O(1) extra space.

A Meta technical screen follow-up to the XOR pairing problem, where XOR alone no longer works. The interviewer checks whether you can count bits modulo 3 or derive the two-variable state machine, and handle negative numbers.

What the Interviewer Expects
  • Explain why plain XOR fails for triples
  • Count each bit position modulo 3
  • Handle negative numbers with 32-bit two's complement
  • Optionally derive the ones/twos bitwise state machine
  • State O(32n) time and O(1) space
Key Topics to Cover
Bit counting
Modular arithmetic
State machine
Two's complement
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Generalize to every element appearing k times except one appearing p times.
  • Explain the ones/twos state transition as a finite automaton.
  • What if the unique element appears twice instead of once?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: list of 32-bit signed integers. Every value appears exactly three times except one appearing once. Output: that value. Constraints: linear time, constant extra space (no hash map)....

High-Level Design

For each bit position b in 0..31, count how many numbers have that bit set. Values that appear three times contribute a multiple of 3 to every count, so count % 3 is exactly the unique value's bit a...


Submit Your Answer
Markdown supported