Skip to content

Commit fdc1655

Browse files
authored
Merge pull request vJechsmayr#431 from riwim/feature/keyboard-row
Solve Leet Code problem 0500 "Keyboard Row"
2 parents 8af6b78 + dca6e06 commit fdc1655

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

LeetCode/0500_Keyboard_Row.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
3+
def findWords(self, words: List[str]) -> List[str]:
4+
rows = ["qwertyuiop", "asdfghjkl", "zxcvbnm"]
5+
is_in_row = lambda word, row: all(letter in row for letter in set(word.lower()))
6+
return [word for word in words if any(is_in_row(word, row) for row in rows)]

0 commit comments

Comments
 (0)