Created
November 5, 2019 14:38
-
-
Save nbgoodall/276af335c04800c1356a7de63a44615b 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 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