replace(i, "") return s ## 逐个子母来收集非元音 def removeVowels(s: str) -> str: vowels = "aeiou" result = "" for char in s: if char not in vowels: result += char return result 复杂度分析: 时间复杂度:O(n),其中 n 是字符串的长度,因为我们需要遍历整个字符串。 空间复杂度:O(...
Can you solve this real interview question? Remove Vowels from a String - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
1classSolution {2func removeVowels(_ S: String) ->String {3let arrS:[Character] =Array(S)4varret:String =String()5foriin0..<S.count6{7ifarrS[i] =="a"|| arrS[i] =="e"|| arrS[i] =="i"|| arrS[i] =="o"|| arrS[i] =="u"8{9continue10}11else12{13ret.append(a...
题目描述 题目描述 题解 提交记录 提交记录 代码 题解不存在 请查看其他题解 9 1 2 › "leetcodeisacommunityforcoders" "aeiou" Source 该题目是 Plus 会员专享题 感谢使用力扣!您需要升级为 Plus 会员来解锁该题目 升级Plus 会员
Remove Sub-Folders from the Filesystem 1232. Check If It Is a Straight Line 1227. Airplane Seat Assignment Probability 1224. Maximum Equal Frequency 1223. Dice Roll Simulation 1222. Queens That Can Attack the King 1221. Split a String in Balanced Strings 1220. Count Vowels Permutation 1219. ...