Haskell Odd Occurrences In Array
import Data.Bits (xor)
oddOccurrencesInArray :: [Int] -> Maybe Int
oddOccurrencesInArray [] = Nothing
oddOccurrencesInArray a = Just (foldl1 xor a)
This uses XOR to cancel out pairs, leaving only the value that appears an odd number of times.