Created
September 29, 2014 03:21
-
-
Save bshlgrs/70f85368cc4bf99ef682 to your computer and use it in GitHub Desktop.
This file contains 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
You're lifting weights in a gym, because that's what you're in to. This gym is | |
filled with a weird kind of bar bell bar which can only fit one weight on each | |
end of it. | |
Frustratingly, the weights might not be evenly matched. You want to do some | |
with as even a weight as possible. So you need to find the two weights | |
with the closest weight to each other. | |
Your input will be an array of weights, for example [2,10,15,25]. | |
Your output should be an array containing the two weights which have the | |
closest weight to each other. | |
In that case, the output would be [10,15]. (Your right arm is stronger than | |
your left, so put the heavier weight on the right.) In case of ties, pick the | |
heaviest pair, because you're a gym bro like that. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment