Last active
August 29, 2015 14:02
-
-
Save latompa/8c3fc514b856e79660b0 to your computer and use it in GitHub Desktop.
load a barbell challenge
This file contains hidden or 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
;; 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