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
Lonely Integer
Sort by
recency
|
580 Discussions
|
Please Login in order to post a comment
I was too bored to use count(): def lonelyinteger(a): s = list(set(a)) for number in s: try: a.remove(number) a.remove(number) except ValueError as V: return(number)
XOR
Here is my c++ solution, you can watch the vidéo explanation here : https://youtu.be/E4PVCUOdeXM
My Java solution with o(n) time complexity and constant space: