Last active
December 2, 2018 05:45
-
-
Save jaihindhreddy/0720c232d2ab38ec3233a736431d3bdf to your computer and use it in GitHub Desktop.
Advent of Code 2018 Day 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def input (->> (slurp "input.txt") | |
clojure.string/split-lines | |
(map #(Integer. %)))) | |
(def part-1 (apply + input)) | |
(def part-2 (->> (cycle input) | |
(reductions + 0) | |
(reduce (fn [seen? v] | |
(if (seen? v) | |
(reduced v) | |
(conj seen? v))) | |
#{})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment