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
require 'benchmark/ips' | |
ARRAY = [1,2,3,1,'2',4,'5',6,7,8,9,'10'] | |
Benchmark.ips do |x| | |
x.report("for") { | |
result = [] | |
for number in ARRAY | |
result << number.to_s | |
end |
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
#write your code here | |
def vowel?(letter) | |
['a', 'e', 'i', 'o', 'u'].include?(letter) | |
end | |
def process_letter(char, hash) | |
if hash[:first_vowel_not_found] | |
if vowel?(char) | |
hash[:before_first_vowel] << "ay" |