Compare commits
No commits in common. "7f4c26085568b4b5befda7097f0efea29d9295e3" and "a9b1c3598480a9e7bdc3f28aedbea2cd2032dba5" have entirely different histories.
7f4c260855
...
a9b1c35984
@ -1,5 +1,6 @@
|
||||
(ns day01
|
||||
(:require input-manager))
|
||||
(:require input-manager
|
||||
#_[clojure.string :as str]))
|
||||
|
||||
(defn parse-line [line]
|
||||
[(.charAt line 0)
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
(ns day03
|
||||
(:require input-manager))
|
||||
|
||||
(def input (input-manager/get-input 2025 3))
|
||||
|
||||
(defn max-joltage [bank num-batteries-to-activate]
|
||||
(let [len (count bank)]
|
||||
(loop [n num-batteries-to-activate
|
||||
acc ""
|
||||
idx-iter 0]
|
||||
(let [search-space (.substring bank idx-iter (- len (dec n)))
|
||||
max-char (apply max (map int search-space))
|
||||
max-char-idx (.indexOf bank max-char idx-iter)]
|
||||
(if (= n 1)
|
||||
(parse-long (str acc (char max-char)))
|
||||
(recur (dec n)
|
||||
(str acc (char max-char))
|
||||
(inc max-char-idx)))))))
|
||||
|
||||
(->> input
|
||||
(map #(max-joltage % 2))
|
||||
(apply +))
|
||||
|
||||
(->> input
|
||||
(map #(max-joltage % 12))
|
||||
(apply +))
|
||||
Loading…
x
Reference in New Issue
Block a user