Skip to content

Instantly share code, notes, and snippets.

@invasionofsmallcubes
Last active December 3, 2019 16:52
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 invasionofsmallcubes/8fc4f22ef747d049b7e0456c786cfd86 to your computer and use it in GitHub Desktop.
Save invasionofsmallcubes/8fc4f22ef747d049b7e0456c786cfd86 to your computer and use it in GitHub Desktop.
Advent Of Code - 2019 - DAY 1 - EX 1 #adventOfCode2019
;; https://adventofcode.com/2019/day/1
(def massDatabase []) ;; get the input in the link
(defn roundDown
[num] (int (Math/floor num)))
(defn fuelRequired
[mass]
(- (roundDown (/ mass 3)) 2)
)
(reduce + (map fuelRequired massDatabase))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment