Single Number - Implementation

Here is the implementation:

function singleNumber(nums):
    result = 0
    for num in nums:
        result = result XOR num
    return result

This runs in O(n)O(n) time with O(1)O(1) space (excluding input). XOR is associative and commutative, so order doesn't matter.