AoC/2019/day4/day4.hs

12 lines
231 B
Haskell
Raw Normal View History

import Data.List
2019-12-09 02:21:01 +01:00
main = print $ day4 [130254..678275] <$> [p,p']
2019-12-09 02:21:01 +01:00
day4 r f = (length . filter f . map show) r
2019-12-04 11:13:17 +01:00
p x | sort x /= x = False
| nub x == x = False
| otherwise = True
2019-12-09 02:21:01 +01:00
p' x = 2 `elem` map length (group x) && p x