leetCode 345. Reverse Vowels of a String文字列
1002 ワード
345. Reverse Vowels of a String
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".
考え方:
アクセントアルファベットを見つけて、位置をマークして、置換します.
コードは次のとおりです.
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".
考え方:
アクセントアルファベットを見つけて、位置をマークして、置換します.
コードは次のとおりです.
// vowels( ) :a,e,i,o,u.
class Solution {
public:
bool isVowels(char c)
{
char vowels[10] = {'a','e','i','o','u','A','E','I','O','U'};
for(int i = 0; i recordIndex;
vector str;
for(int i = 0;i
2016-08-08 10:52:10