Tap here to switch tabs
Problem
Submissions

Problem: Single Number

Single Number gives you an integer array where every value appears twice except one. Return the unique value, using linear time and constant extra space.

Statement

Given an array of integers, where every element appears twice except for one, find the element that occurs only once.

Note: The solution must have linear runtime and constant space complexity.

Constraints:

  • 1≤1 \leq nums.length ≤103\leq 10^3
  • −3×103≤-3 \times 10^3 \leq nums[i] ≤3×103\leq 3 \times 10^3
⋮
Tap here to switch tabs
Problem
Submissions

Problem: Single Number

Single Number gives you an integer array where every value appears twice except one. Return the unique value, using linear time and constant extra space.

Statement

Given an array of integers, where every element appears twice except for one, find the element that occurs only once.

Note: The solution must have linear runtime and constant space complexity.

Constraints:

  • 1≤1 \leq nums.length ≤103\leq 10^3
  • −3×103≤-3 \times 10^3 \leq nums[i] ≤3×103\leq 3 \times 10^3