Python one liner without regular expressions

  • 0
    class Solution(object):
        def findWords(self, words):
            :type words: List[str]
            :rtype: List[str]
            return [word for word in words if any([all([char.lower() in row for char in word]) for row in ["qwertyuiop", "asdfghjkl", "zxcvbnm"]])]

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.