Skip to content

Instantly share code, notes, and snippets.

@latompa
Last active August 29, 2015 14:02
Show Gist options
  • Save latompa/8c3fc514b856e79660b0 to your computer and use it in GitHub Desktop.
Save latompa/8c3fc514b856e79660b0 to your computer and use it in GitHub Desktop.
load a barbell challenge
;; With these plates
(def available-plates [45 25 15 10 5 2.5 1.25])
;; Create a function that loads a barbell (weighs 45).
;; With the available plates as close to the goal weight as possible.
;; Assume you have unlimited supply of each plate.
;; Weight has to be evenly distributed on each side.
;; Use as few plates as possible.
;; Example: 45 pound bar bell with 152.5 pounds goal weight
(load-bar available-weights 45 152.5)
;; should return a sequence of weights (including the bar bell)
;; (45 45 45 5 5 2.5 2.5 1.25 1.25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment