Given an array where every element appears twice except for one, find that single element without using extra memory.
This problem can be solved using XOR, which requires no extra memory.
Accepted on the first try. Here is the code:
| |
Given an array where every element appears twice except for one, find that single element without using extra memory.
This problem can be solved using XOR, which requires no extra memory.
Accepted on the first try. Here is the code:
| |