Leetcode 500 Keyboard Row
2022-02-04 17:22 作者:您是打尖儿还是住店呢 | 我要投稿
Given an array of strings words
, return the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below.
In the American keyboard:
the first row consists of the characters
"qwertyuiop"
,the second row consists of the characters
"asdfghjkl"
, andthe third row consists of the characters
"zxcvbnm"
.
如果字符都在一行中能够打出来,则可以输出这个字符串,如果不行,就不输出这个字符串;
类似官方的解答,将所有的字符所在的行数提前做好,判断是否跟第一个都一样,一样就增加,不一样就false,最后汇总,输出,即可。
Runtime: 0 ms, faster than 100.00% of Java online submissions for Keyboard Row.
Memory Usage: 41.7 MB, less than 11.33% of Java online submissions for Keyboard Row.