Skip to content

Instantly share code, notes, and snippets.

@jb55
Created October 19, 2010 02:59
Show Gist options
  • Save jb55/633533 to your computer and use it in GitHub Desktop.
Save jb55/633533 to your computer and use it in GitHub Desktop.
rInt :: String -> Int
rInt = read
count :: String -> Int
count [] = 1
count (a:[]) = 1
count (a:b:c) = count (b:c) + twice
where
twice = if isValid (a:b:[]) then count c else 0
isValid s = (rInt s) < 27
@jb55
Copy link
Author

jb55 commented Oct 19, 2010

count "12325" -> 6
count "11134" -> 5
count "12345" -> 3
count "1123"   -> 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment