Array
136. Single Number
Every number appears twice except one — find the loner in O(n) time and O(1) space. The hash-set or sort-and-scan answers work but cost memory or a log factor; XOR does it with a single accumulator,…
Loading…
Every number appears twice except one — find the loner in O(n) time and O(1) space. The hash-set or sort-and-scan answers work but cost memory or a log factor; XOR does it with a single accumulator,…
Loading…