mirror of
https://github.com/TheAlgorithms/Ruby
synced 2024-12-29 22:24:07 +01:00
29 lines
No EOL
524 B
Ruby
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))
|
|
# => "" |