Leetcode 500 Keyboard Row
来源:互联网 发布:斯诺登现状2017 知乎 编辑:程序博客网 时间:2024/05/16 14:39
Leetcode 500 Keyboard Row
#include <string>using namespace std;class Solution {public: vector<string> findWords(vector<string>& words) { string firstLine = "qwertyuiopQWERTYUIOP"; string secondLine = "asdfghjklASDFGHJKL"; string thirdLine = "zxcvbnmZXCVBNM"; vector<string> result; int oneflag,secondflag,thirdflag = 0; //c++ 11 for(auto& word : words) { for(auto& letter : word) { if(firstLine.find(letter) != firstLine.npos)//string::npos also is fine oneflag = 1; else if(secondLine.find(letter) != string::npos) secondflag = 1; else if(thirdLine.find(letter) != string::npos) thirdflag = 1; } if(oneflag + secondflag + thirdflag == 1) { result.push_back(word); } oneflag = 0; secondflag = 0; thirdflag = 0; } return result; }};
阅读全文
0 0
- leetcode-500-Keyboard Row
- leetcode 500 keyboard row
- Leetcode #500 Keyboard Row
- LeetCode 500 Keyboard Row
- LeetCode 500: Keyboard Row
- 【LeetCode】500 Keyboard Row
- #leetcode#500 Keyboard Row
- LeetCode 500 Keyboard Row
- Leetcode 500 Keyboard Row
- LeetCode-500-Keyboard Row
- LeetCode.500 Keyboard Row
- leetcode 500 Keyboard Row C++
- leetcode 500 Keyboard Row Add to List
- Leetcode-500. Keyboard Row
- 【Leetcode】500. Keyboard Row
- 【LeetCode】500. Keyboard Row
- LeetCode 500. Keyboard Row
- LeetCode 500. Keyboard Row
- 解密
- PPM图像格式说明
- 矩形面积并
- Java编程思想读书笔记——控制执行流程
- Leetcode 476 Number Complement
- Leetcode 500 Keyboard Row
- Linux利用crontab创建计划任务详解
- 使用struts2框架遇到的问题
- jsp+servlet验证码验证
- Leetcode 53 Maximum Subarray
- Maximum Subarray
- Leetcode 566 Reshape the Matrix
- LeetCode 0683
- install phantomjs 2.1.1