Created
April 28, 2017 08:52
-
-
Save radralph/98d703fbc603a3df8df9d79f2c4eb873 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 solution(digits) | |
puts digits | |
digits = digits.to_s.split(//) | |
mSize, allResult = digits.size, [] | |
digits.each_with_index do |x, index| | |
temp = [] | |
index.to_i.upto(mSize) do |y| | |
temp << digits[y].to_i | |
if temp.size.eql? 5 | |
allResult << temp.join("") | |
temp = [] | |
break | |
end | |
end | |
end | |
puts allResult.sort | |
puts "-----" | |
puts allResult.max | |
return allResult.max | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment