Skip to content

Instantly share code, notes, and snippets.

@lexruee
Last active March 19, 2020 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lexruee/ac15e5d0337bcc1b4cc4bf61e275750e to your computer and use it in GitHub Desktop.
Save lexruee/ac15e5d0337bcc1b4cc4bf61e275750e to your computer and use it in GitHub Desktop.
Find the missing letter in the passed letter range and return it.
def find_missing_letter(range)
chars = range.chars
max_char = chars.max
min_char = chars.min
missing_chars = (min_char..max_char).to_a - chars
missing_chars.first
end
p find_missing_letter "abde"
p find_missing_letter "abcdefgijk"
p find_missing_letter "abcdef"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment