Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 49faa0b

Browse files
Remove vowels from a string
1 parent 1bdbf26 commit 49faa0b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎1119_removeVowelsFromAString.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @param {string} s Input string, can contain vowels.
3+
* @return {string} String with vowels removed
4+
* @summary Remove Vowels from a String {@link https://leetcode.com/problems/remove-vowels-from-a-string/}
5+
* @description Return a string with vowels (a, e, i, o, u) removed
6+
* Space O(n) - where n is s.length, create array from input string.
7+
* Time O(n) - where n is s.length, iterate over string length.
8+
*/
9+
const removeVowels = s =>
10+
s
11+
.split('')
12+
.filter(c => !['a', 'e', 'i', 'o', 'u'].includes(c))
13+
.join('');

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /