Skip to content

Instantly share code, notes, and snippets.

@iafsilva
Created May 4, 2023 15:04
Show Gist options
  • Save iafsilva/b11e75785d2dbacb453f2483f97d9b62 to your computer and use it in GitHub Desktop.
Save iafsilva/b11e75785d2dbacb453f2483f97d9b62 to your computer and use it in GitHub Desktop.
OddOccurrencesInArray-MidSolution
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