0c5c08d1daf9c8c25787db382c66547d9205e10a
[adventofcode2019.git] / src / adventofcode2019 / day04.clj
1 (ns adventofcode2019.day04
2 [:require [adventofcode2019.lib :refer :all]
3 [clojure.string :as str]
4 [clojure.math.combinatorics :as combo]])
5
6 (defn find-passwords [low high]
7 (let [dupe-digits #(some (partial apply =) (partition 2 1 %))
8 increasing (partial apply <=)
9 to-digits #(map int (str %))]
10 (->> (range low (inc high))
11 (map to-digits)
12 (filter (every-pred dupe-digits increasing)))))
13
14 (defn day04 []
15 (let [[low high] [0 1]
16 passwords (find-passwords low high)]
17 (part1 (count passwords))
18 #_(part2 nil)))