AoC/2019/day4/day4.hs
2019-12-09 02:21:01 +01:00

12 lines
231 B
Haskell

import Data.List
main = print $ day4 [130254..678275] <$> [p,p']
day4 r f = (length . filter f . map show) r
p x | sort x /= x = False
| nub x == x = False
| otherwise = True
p' x = 2 `elem` map length (group x) && p x