Add brute force solution

This commit is contained in:
Jessica Kwok 2021-03-26 10:03:45 -07:00
parent b4806f0903
commit 8bafd5c74a

View file

@ -14,11 +14,22 @@
# @return {String}
#
# Approach 1:
# Approach 1: Brute Force
#
# Time Complexity:
# Time Complexity: O(n)
#
def remove_vowels(s)
result_array = []
s.downcase
start_array = s.split('')
start_array.each do |letter|
if letter != 'a' && letter != 'e' && letter != 'i' && letter != 'o' && letter != 'u'
result_array.push(letter)
end
end
result_array.join('')
end
s = 'leetcodeisacommunityforcoders'