46. leetcode 500. Keyboard Row

500. Keyboard Row

Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.

 

 

Example 1:

Input: ["Hello", "Alaska", "Dad", "Peace"]
Output: ["Alaska", "Dad"]

Note:

  1. You may use one character in the keyboard more than once.
  2. You may assume the input string will only contain letters of alphabet.

思路:给定一串单词,找出其中所有字母都来自键盘上的同一行的单词。详情直接看代码,代码借鉴的网上的,写得很不错。注意大小写的统一。

 

 

posted @ 2017-04-09 21:59  蓦然闻声  阅读(357)  评论(0编辑  收藏  举报