Created
August 29, 2018 02:03
-
-
Save juanfurattini/1f3b47c31cc619413d9a3f7f67de92f5 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(a) | |
return 1 unless a.include?(1) | |
val = 0 | |
a.uniq.sort.each do |e| | |
next if e <= 0 | |
return val.next if e > val.next | |
val = e | |
end | |
val.next | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment