Test day4pt1 and add correct day4pt2
authorJack Kinsey <j.jameskinsey@gmail.com>
Thu, 5 Dec 2019 00:44:39 +0000 (19:44 -0500)
committerJack Kinsey <j.jameskinsey@gmail.com>
Thu, 5 Dec 2019 00:44:39 +0000 (19:44 -0500)
src/adventofcode2019/core.clj
src/adventofcode2019/day04.clj

index 68320b98979692a4356e5c5e3deb7c79c29f2941..fb1a3209fe111f09f982bd70f190278a3ac88745 100644 (file)
@@ -1,5 +1,6 @@
 (ns adventofcode2019.core
-    [:require (adventofcode2019 day01 day02 day03)])
+    [:require (adventofcode2019 day01 day02 day03
+                                day04)])
 
 (defn -main 
   ([]
index 0c5c08d1daf9c8c25787db382c66547d9205e10a..0129398da89f405de8aa5761eece621dfeee0468 100644 (file)
@@ -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)))))