Skip to content

Instantly share code, notes, and snippets.

@capitalsav
Created August 15, 2019 20:55
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 capitalsav/f599be9a6b2d33d6551e2237944367a2 to your computer and use it in GitHub Desktop.
Save capitalsav/f599be9a6b2d33d6551e2237944367a2 to your computer and use it in GitHub Desktop.
def solve(arr)
alphabet = ('a'..'z').to_a
result = []
arr.each do |word|
count = 0
word.split('').each_with_index do |letter, index|
count +=1 if alphabet.find_index(letter.downcase) == index
end
result.push(count)
end
result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment