136 Single Number
136 Single Number
Description
Given2*n + 1
numbers, every numbers occurs twice except one, find it.
Example
Given[1,2,2,1,3,4,3]
, return4
Challenge
One-pass, constant extra space.
这题利用的是异或的性质。loop一遍O(n)做完。
Last updated