Skip to content

@ehamberg /firstNonRep.hs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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.