Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import qualified Data.HashMap.Lazy as M -- from unordered-containers
firstNonRep :: String -> Char
firstNonRep =
head . M.keys . M.filter (==1) . M.fromListWith (+) . map (\c -> (c,1))
main = print $ firstNonRep "aabcbcdeef" == 'd'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment