Write a function that takes a string as input and reverse only the vowels of a string.
Example 1:
Given s = “hello”, return “holle”.
Example 2:
Given s = “leetcode”, return “leotcede”.
Note:
The vowels does not include the letter “y”.
public String reverseVowels(String s) {
char[] ss = s.toCharArray();
int j = ss.length - 1, i = 0;
char temp;
while (i < j) {

编写一个函数,输入字符串并只反转其中的元音字母。例如,输入'hello',返回'holle';输入'leetcode',返回'leotcede'。注意:元音不包括字母'y'。
订阅专栏 解锁全文
571

被折叠的 条评论
为什么被折叠?



