500. Keyboard Row Easy
1/**
2 * [500] Keyboard Row
3 *
4 * 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.
5 * In the American keyboard:
6 *
7 * the first row consists of the characters "qwertyuiop",
8 * the second row consists of the characters "asdfghjkl", and
9 * the third row consists of the characters "zxcvbnm".
10 * <img alt="" src="https://assets.leetcode.com/uploads/2018/10/12/keyboard.png" style="width: 800px; max-width: 600px; height: 267px;" />
11 *
12 * Example 1:
13 *
14 * Input: words = ["Hello","Alaska","Dad","Peace"]
15 * Output: ["Alaska","Dad"]
16 *
17 * Example 2:
18 *
19 * Input: words = ["omk"]
20 * Output: []
21 *
22 * Example 3:
23 *
24 * Input: words = ["adsdf","sfd"]
25 * Output: ["adsdf","sfd"]
26 *
27 *
28 * Constraints:
29 *
30 * 1 <= words.length <= 20
31 * 1 <= words[i].length <= 100
32 * words[i] consists of English letters (both lowercase and uppercase).
33 *
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/keyboard-row/
38// discuss: https://leetcode.com/problems/keyboard-row/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43 pub fn find_words(words: Vec<String>) -> Vec<String> {
44 vec![]
45 }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52 use super::*;
53
54 #[test]
55 fn test_500() {
56 }
57}
58
Back
© 2025 bowen.ge All Rights Reserved.