Search
⌘K

Leetcode 136. Single Number

Given an array where every element appears exactly twice except for one, return the element that appears only once. Achieve O(n) time and O(1) space — this is typically solved by XORing all numbers so matching pairs cancel out.

Asked at:

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early December, 2024

Amazon

Amazon

Mid-level

Find the unpaired number in an array of 2n+1 numbers where all other numbers are paired and adjacent

Comments

Your account is free and you can post anonymously if you choose.