We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Lonely Integer
- Discussions
Lonely Integer
Lonely Integer
Sort by
recency
|
918 Discussions
|
Please Login in order to post a comment
Python:
It didn't occur to me to xor the array. Has anyone here thought of it?
Solution in c++.
int lonelyinteger(vector a) {
}
Solution in Java
It's rare to see, but Python has its own XOR operator!
Just be aware that the following code does not works if the array has an element with more than two occurrences: