Python Solution


  • 0
    A
    class Solution(object):
        def findWords(self, words):
            """
            :type words: List[str]
            :rtype: List[str]
            """
            keyrows = ('asdfghjkl', 'qwertyuiop', 'zxcvbnm')
            output = []
            for w in words:
                for row in keyrows:
                    if all(x.lower() in row for x in w):
                        output.append(w)
                        break
            return output
    

    Does number of lines really matter?


Log in to reply
 

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