Skip to content

Instantly share code, notes, and snippets.

@stuartstein777
Created December 3, 2020 16:15
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 stuartstein777/b9e34125f48d3c7791c2e08e7c41e576 to your computer and use it in GitHub Desktop.
Save stuartstein777/b9e34125f48d3c7791c2e08e7c41e576 to your computer and use it in GitHub Desktop.
advent-of-code-2020-day3
(defn is-tree [x i]
(= \# (nth i (mod x (count i)))))
(let [input (->> (slurp "input.txt")
(str/split-lines))
x-step 7
y-step 1]
(->> (take-nth y-step input)
(map is-tree (iterate #(+ x-step %) 0))
(filter true?)
(count)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment