Created
August 19, 2011 11:20
-
-
Save ehamberg/1156601 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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