LeetCode 345 反转元音字符串
来源:互联网 发布:centos 中英输入法转换 编辑:程序博客网 时间:2024/05/23 14:16
import java.util.HashSet;public class Solution { static HashSet<Character> set = new HashSet<>(); static{ set.add('a'); set.add('e'); set.add('i'); set.add('o'); set.add('u'); set.add('A'); set.add('E'); set.add('I'); set.add('O'); set.add('U'); } public String reverseVowels(String s) { char[] chs = s.toCharArray(); int start =0,end = chs.length-1; char temp; while(start<end){ if(set.contains(chs[start])){ while(!set.contains(chs[end])){ end--; } if(start!=end){ temp = chs[start]; chs[start] = chs[end]; chs[end] = temp; end--; } } start++; } return new String(chs); }}
0 0
- LeetCode 345 反转元音字符串
- Leetcode反转元音字母
- 元音字母的字符串反转
- LeetCode Reverse Vowels of a String(字符串中元音字符反转)
- leetcode 345. Reverse Vowels of a String 反转字符串元音字符
- java字符串中元音字母反转
- [Leetcode]字符串的反转
- python 元音字母反转
- 元音与非元音字符串
- LeetCode按单词反转字符串
- 字符串反转--Leetcode Reverse String
- LeetCode Reverse String(字符串反转)
- 字符串之统计元音
- 输出字符串中的元音
- leetcode之反转给定字符串中的单词
- [Leetcode,python] Reverse String 反转字符串
- LeetCode----344. Reverse String 字符串反转
- [LeetCode]344. Reverse String(反转字符串)
- QT + OpenCV2.4.10环境搭建,我用的是vs2013编译器
- 香农信息熵
- 125. Valid Palindrome
- JVM内存管理
- lcs 入门题 模板
- LeetCode 345 反转元音字符串
- 第八周上机实践项目 项目2-用对象数组操作长方柱类
- socket函数1
- 哈希表
- 高光谱遥感图像处理(11)----ENVI建立矢量数据
- [BZOJ2060][Usaco2010 Nov]Visiting Cows 拜访奶牛(树形dp)
- Androidn Notification的使用,解决找不到setLatestEventInfo方法
- FormData实现异步传送带文件的表单
- 121. Best Time to Buy and Sell Stock