Leetcode500. Keyboard Row
来源:互联网 发布:人体尺寸数据 编辑:程序博客网 时间:2024/06/05 15:00
class Solution {public: vector<string> findWords(vector<string>& words) { vector<string> ret; int sz=words.size(); for(int i=0;i<sz;i++){ if(isOnlyOne(words[i])) ret.push_back(words[i]); } return ret; } private: bool isOnlyOne(const string&s){ static const string key[]={"qwertyuiop","asdfghjkl","zxcvbnm"}; int sz=s.size(); int o=0; for(int i=0;i<sz;i++){ for(int k=0;k<3;k++){ if(find(key[k].begin(),key[k].end(),tolower(s[i]))!=key[k].end()){ if(!i) o=k; else { if(k!=o) return false; } } } } return true; }};
阅读全文
0 0
- leetcode500: Keyboard Row
- leetcode500 Keyboard Row Java
- Leetcode500. Keyboard Row
- leetcode500. Keyboard Row
- LeetCode500. Keyboard Row
- Leetcode500. Keyboard Row
- python--leetcode500. Keyboard Row
- 14.leetCode500:keyboard row
- LeetCode500. Keyboard Row我的C++解法
- Keyboard Row
- Keyboard Row
- Keyboard Row
- Keyboard Row
- Keyboard Row
- Keyboard Row
- Keyboard Row
- Keyboard Row
- Keyboard Row
- 业余时间决定了你的人生
- MySQL server has gone away 问题分析
- Redis在Windows上编译
- 【线段树+扫描线】HDU 1542+1255
- mobienet
- Leetcode500. Keyboard Row
- java使double保留两位小数的多方法 java保留两位小数
- Spring Data JPA使用复合主键
- AlexNet网络结构
- mysql的主从复制与读写分离
- 从本地读数据并转为Map格式
- 1.1 关于ARM中重定位:位置有关码和位置无关码及运行地址和链接地址
- django1.11.4 连接mysql
- 跳槽>买房?