Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ1027
Page ↗
Q1027FWASIC interview problem

Find the single non-duplicate

TechniquesBitsXOR
DifficultyEasy
TopicBit Manipulation
LanguageSystemVerilog
Requirements3 checkpoints
01

Problem

Every integer in an array appears exactly twice except one. Return the value that appears once.

Example input and output

Use this case to check your interpretation
Input
values = [4, 1, 2, 1, 2]
Output
4
Explanation

Equal values cancel under XOR, leaving the value that appears only once.

02

Requirements (3)

  • Use constant extra space.
  • Do not sort the input.
  • Assume exactly one singleton exists.