Pythonic Solution

  • 0
    class Solution(object):
        def groupStrings(self, strings):
            from collections import defaultdict
            d = defaultdict(list)
            for s in strings:
            return d.values()
        def getKey(self, s):
            return tuple((ord(c) - ord(s[0])) % 26 for c in s)

Log in to reply

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