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”.
Enough said, similar questions:https://blog.jing.do/4766
public class Solution { public String reverseVowels(String s) { if(s == null || s.length()==0) return s; String vowels = 'aeiouAEIOU'; char[] chars = s.toCharArray(); int start = 0; int end = s.length()-1; while(start This siteOriginal articleAll follow "Attribution-NonCommercial-ShareAlike 4.0 License (CC BY-NC-SA 4.0)Please retain the following annotations when sharing or adapting:
Original author:Jake Tao,source:"LeetCode – 345. Reverse Vowels of a String"