TheAlgorithms-Ruby/data_structures/arrays/remove_vowels.rb
2021-03-26 09:48:52 -07:00

29 lines
No EOL
524 B
Ruby

# Challenge name: Remove vowels from a string
#
# Given a string s, remove the vowels 'a', 'e', 'i', 'o', and 'u'
# from it, and return the new string.
# Example 1:
# Input: s = "leetcodeisacommunityforcoders"
# Output: "ltcdscmmntyfrcdrs"
#
# Example 2:
# Input: s = "aeiou"
# Output: ""
#
# @param {String} s
# @return {String}
#
# Approach 1:
#
# Time Complexity:
#
def remove_vowels(s)
end
s = 'leetcodeisacommunityforcoders'
print(remove_vowels(s))
# => "ltcdscmmntyfrcdrs"
s = 'aeiou'
print(remove_vowels(s))
# => ""