Python regexp + dict

  • 0
    class Solution(object):
        def findDuplicate(self, paths):
            :type paths: List[str]
            :rtype: List[List[str]]
            hash = collections.defaultdict(list)
            match = re.compile('(.*)\((.*)\)')
            for p in paths:
                strlist = p.split()
                for i in range(1, len(strlist)):
                    m =[i])
                    hash[].append(strlist[0] + '/' +
            return [l for l in hash.values() if len(l) > 1]

Log in to reply

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