Skip to content

Instantly share code, notes, and snippets.

@mckomo
Created December 27, 2014 13:02
Show Gist options
  • Save mckomo/1226a66857d7a7a3c2fa to your computer and use it in GitHub Desktop.
Save mckomo/1226a66857d7a7a3c2fa to your computer and use it in GitHub Desktop.
Codility – MissingInteger
def solution(a)
n = a.length
r = (1 .. n).to_a
diff = r - a
if diff.empty?
return n+1
end
diff.first
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment