Last active
July 26, 2018 05:20
-
-
Save juanfurattini/0b3cd63ccd8bb3e231e0cde4861556d0 to your computer and use it in GitHub Desktop.
Solution for Codility's MissingInteger exercise with a score of 100% (Ruby)
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) | |
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