Skip to interview prep
Apexed
Problem list109 / 125

109. Single Number Among Triples

MediumMiscellaneous

In nums, every value appears exactly three times except one, which appears exactly once. Return that value using O(1) extra memory.

Example 1

Input: nums = [2, 2, 3, 2]
Output: 3

Constraints

  • 1 ≤ nums.length ≤ 3 · 10⁴
  • Values fit in a 32-bit signed integer

Tab indents · Ctrl/⌘ + Enter runs · Esc then Tab leaves the editor

Run checks these cases; the expected output comes from the reference solution. Submit judges all 4 hidden and sample tests.

Code runs only in your browser in an isolated sandbox. Progress and submissions are saved on this device.

Single Number Among Triples — coding interview practice — Apexed