From b4806f090372d4e2fadb66d3a5bb26eae031b02f Mon Sep 17 00:00:00 2001 From: Jessica Kwok Date: Fri, 26 Mar 2021 09:48:52 -0700 Subject: [PATCH] Add remove vowels challenge --- DIRECTORY.md | 1 + data_structures/arrays/remove_vowels.rb | 29 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 data_structures/arrays/remove_vowels.rb diff --git a/DIRECTORY.md b/DIRECTORY.md index 8fea99b..4c10a66 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -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) diff --git a/data_structures/arrays/remove_vowels.rb b/data_structures/arrays/remove_vowels.rb new file mode 100644 index 0000000..d1dbabf --- /dev/null +++ b/data_structures/arrays/remove_vowels.rb @@ -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)) +# => "" \ No newline at end of file