Created
August 15, 2019 20:55
-
-
Save capitalsav/f599be9a6b2d33d6551e2237944367a2 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 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