Skip to content
Create a gist now

Instantly share code, notes, and snippets.

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
Something went wrong with that request. Please try again.