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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Math problems