Compare commits

..

No commits in common. "de3c367d1c4ab40312705c50f6964ae6aeab3a97" and "66c7ee02d4d7d59c41bd5464f444f21e851ea541" have entirely different histories.

2 changed files with 0 additions and 35 deletions

View File

@ -1,21 +0,0 @@
(ns day04
(:require [input-manager]
[clojure.set])
(:import java.security.MessageDigest java.math.BigInteger))
(def input (input-manager/get-input-raw 2015 4))
(defn string->md5 [s]
(let [algorithm (MessageDigest/getInstance "MD5")
raw (.digest algorithm (.getBytes s))]
(format "%032x" (BigInteger. 1 raw))))
(defn solution [target-prefix]
(loop [i 0]
(let [md5 (string->md5 (str input i))]
(if (.startsWith md5 target-prefix)
i
(recur (inc i))))))
(solution "00000")
(solution "000000")

View File

@ -1,14 +0,0 @@
(ns day05
(:require [input-manager]
[clojure.string :as str]))
(def input (input-manager/get-input 2015 5))
(def bad #{"ab" "cd" "pq" "xy"})
;; part 1
(count (filter #(and (not (some (partial str/includes? %) bad))
(>= (count (filter #{\a \e \i \o \u} %)) 3)
(some (partial apply =) (concat (partition 2 %)
(partition 2 (rest %)))))
input))