Talentd
FleetCode

1119. Remove Vowels from a String

Easy91.2% acceptance1 companyPremium elsewhere, free here

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: ""

Constraints:

  • 1 <= s.length <= 1000
  • s consists of only lowercase English letters.

Asked at 1 company

Topics

Hints open one at a time

Hint 1
How to erase vowels in a string?
Hint 2
Loop over the string and check every character, if it is a vowel ignore it otherwise add it to the answer.
5:43
Still stuck?Read the written solution, or watch a walkthrough.
Open solution
Loading editor…
1class Solution:
2 def solve(self):
3 pass
4
Starter codePython 3Spaces: 4
Examples
Input
"leetcodeisacommunityforcoders"
Input
"aeiou"
Your code is saved on this device.Solution