Keyboard Row LeetCode solution in Python
1class Solution:2def findWords(self, words: List[str]) -> List[str]:3#4set1 = {"q", "w", "e", "r", "t", "y", "u", "i", "o", "p"}5set2 = {"a", "s", "d", "f", "g", "h", "j", "k", "l"}6set3 = {"z", "x", "c", "v", "b", "n", "m"}78res = []9for i in words:10wordset = set(i.lower())11if (12(wordset & set1 == wordset)13or (wordset & set2 == wordset)14or (wordset & set3 == wordset)15):16res.append(i)17return res