Skip to content

Instantly share code, notes, and snippets.

@nbgoodall
Created November 5, 2019 14:38
Show Gist options
  • Save nbgoodall/276af335c04800c1356a7de63a44615b to your computer and use it in GitHub Desktop.
Save nbgoodall/276af335c04800c1356a7de63a44615b to your computer and use it in GitHub Desktop.
def missing_ints(arr)
(arr.min..arr.max).to_a - arr
end
missing_ints([1, 3, 3, 5, 6])
# => [2, 4]
missing_ints([1, 2, 3, 4, 4, 7, 7])
# => [5, 6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment