From b49567e7f99c079675b87a29681bafe5cf834e1e Mon Sep 17 00:00:00 2001 From: Jack Kinsey Date: Wed, 4 Dec 2019 19:44:39 -0500 Subject: [PATCH] Test day4pt1 and add correct day4pt2 --- src/adventofcode2019/core.clj | 3 ++- src/adventofcode2019/day04.clj | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/adventofcode2019/core.clj b/src/adventofcode2019/core.clj index 68320b9..fb1a320 100644 --- a/src/adventofcode2019/core.clj +++ b/src/adventofcode2019/core.clj @@ -1,5 +1,6 @@ (ns adventofcode2019.core - [:require (adventofcode2019 day01 day02 day03)]) + [:require (adventofcode2019 day01 day02 day03 + day04)]) (defn -main ([] diff --git a/src/adventofcode2019/day04.clj b/src/adventofcode2019/day04.clj index 0c5c08d..0129398 100644 --- a/src/adventofcode2019/day04.clj +++ b/src/adventofcode2019/day04.clj @@ -12,7 +12,9 @@ (filter (every-pred dupe-digits increasing))))) (defn day04 [] - (let [[low high] [0 1] - passwords (find-passwords low high)] + (let [[low high] [307237 769058] + passwords (find-passwords low high) + strict-dd (fn [x] (some #(= (count %) 2) + (partition-by identity x)))] (part1 (count passwords)) - #_(part2 nil))) + (part2 (count (filter strict-dd passwords))))) -- 2.26.2