Add remove vowels challenge

This commit is contained in:
Jessica Kwok 2021-03-26 09:48:52 -07:00
parent c4725e9eb2
commit b4806f0903
2 changed files with 30 additions and 0 deletions

View file

@ -14,6 +14,7 @@
* [Get Products Of All Other Elements](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/get_products_of_all_other_elements.rb)
* [Jewels And Stones](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/jewels_and_stones.rb)
* [Remove Elements](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/remove_elements.rb)
* [Remove Vowels](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/remove_vowels.rb)
* [Single Number](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/single_number.rb)
* [Sort Squares Of An Array](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/sort_squares_of_an_array.rb)
* [Two Sum](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/two_sum.rb)

View file

@ -0,0 +1,29 @@
# 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))
# => ""