Created
May 12, 2015 16:27
-
-
Save TrevorS/5e14454487dff30e67e3 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 find_best_order(array) | |
array.permutation.map { |p| [p, p.reduce { |a, e| a.to_s + e.to_s }] }.max_by { |e| e[1] }.first | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment