我的代码游记

标签 · 堆栈

首页

关于

归档

LeetCodeEasy字符串处理堆栈

345.Reverse Vowels of a String(Easy)

Write a function that takes a string as input and reverse only the vowels of a string.**Note:**The vowels does not include the letter “y”.写一个函数把字符串中的元音字母的顺序调转,‘Y’不是一个元音字母 Example 1: Given s = “hello”, return “holle”. Example 2: Given s = “leetcode”, return “leotcede”. My Solution(Java) Version 1 Time: 5ms:  先一次遍历把元音字母的下标记下来,然后把通过下标直接把字符串中的元音字母逆序,只需要..

更多