Created
November 16, 2012 05:32
-
-
Save swarley/4084459 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
def dist(size, n) | |
m = size % n | |
d = (n-m) % size | |
([d]*(n-m)) + ([1]*(m)) | |
end | |
p dist(10, 12) | |
# [2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment