-
-
Save hamajyotan/fbe65ca6e313f2ba57fd to your computer and use it in GitHub Desktop.
Five programming problems every Software Engineer should be able to solve in less than 1 hour
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 f *args | |
args.map(&:to_s).permutation.map { |x| x.join.to_i }.max | |
end |
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 f *args | |
["", "+", "-"].repeated_permutation(args.size-1).each do |op| | |
args.map(&:to_s).zip(op).join.tap { |s| puts s if eval(s) == 100 } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://www.softantenna.com/wp/software/5-programming-problems/