Created
May 4, 2023 15:04
-
-
Save iafsilva/b11e75785d2dbacb453f2483f97d9b62 to your computer and use it in GitHub Desktop.
OddOccurrencesInArray-MidSolution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun solution(A: IntArray): Int { | |
val counter = HashSet<Int>() | |
for (i in A) if (!counter.remove(i)) counter.add(i) | |
return counter.first() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment