Skip to content

Instantly share code, notes, and snippets.

@radralph
Created April 28, 2017 08:52
Show Gist options
  • Save radralph/98d703fbc603a3df8df9d79f2c4eb873 to your computer and use it in GitHub Desktop.
Save radralph/98d703fbc603a3df8df9d79f2c4eb873 to your computer and use it in GitHub Desktop.
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