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
|
913 Discussions
|
Please Login in order to post a comment
//C#
public static int lonelyinteger(List a) {
Javascript users... a.reduce((acc, num) => acc ^ num, 0);
Use the XOR operator.
This is the solution in scala def lonelyinteger(a: Array[Int]): Int = { a.foldLeft(0)(_ ^ _) }
C++ deserves more love :(
Wrote this solution by Swift, not perfect about alghoritms anyone can improve this for any suggest?