Easy · Math

Find Single Number

Given a non-empty integer array nums in which every value appears exactly twice except for one value that appears once, return that single value.

Examples

Example 1

[4,1,2,1,2] → 4

Output: single = 4

Example 2

[7,3,5,3,7] → 5

Output: single = 5

Rebuild it in the studio

Core interview problems are free with a full runner and lessons; Pro opens the complete library.

More Math problems