Skip to content

Instantly share code, notes, and snippets.

@jaihindhreddy
Last active December 2, 2018 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaihindhreddy/0720c232d2ab38ec3233a736431d3bdf to your computer and use it in GitHub Desktop.
Save jaihindhreddy/0720c232d2ab38ec3233a736431d3bdf to your computer and use it in GitHub Desktop.
Advent of Code 2018 Day 1
(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