This commit is contained in:
Adam Jeniski 2025-12-05 20:44:22 -10:00
parent fdd38bd6b1
commit b0d0cf5b59

View File

@ -28,19 +28,17 @@
op-idx 0 op-idx 0
curr-nums [] curr-nums []
acc 0] acc 0]
(let [op (get ops op-idx)
ans (+ acc (apply op curr-nums))]
(if (> col-idx MAX_LINE_IDX) (if (> col-idx MAX_LINE_IDX)
(+ acc (apply (get ops op-idx) curr-nums)) ans
(let [col (->> nums-raw (let [col (->> nums-raw
(map #(.charAt % col-idx)) (map #(.charAt % col-idx))
(filter (partial not= \space)) (filter (partial not= \space))
(map #(- (int %) (int \0)))) (map #(- (int %) (int \0))))]
op (get ops op-idx)]
(if (empty? col) (if (empty? col)
(recur (inc col-idx) (recur (inc col-idx) (inc op-idx) [] ans)
(inc op-idx)
[]
(+ acc (apply op curr-nums)))
(recur (inc col-idx) (recur (inc col-idx)
op-idx op-idx
(conj curr-nums (parse-long (apply str col))) (conj curr-nums (parse-long (apply str col)))
acc))))) acc))))))