Lonely Integer

  • + 0 comments

    Simply XOR should solve this problem with just O(n) time complexity and O(1) space complexity.

    num = 0 for i in a: num ^=i return num