Short but slow js solution
Runtime: 1446 ms\nMemory Usage: 96.1 MB\n\nvar deleteDuplicateFolder = function(paths) {\n    var root = {}, socks = {};\n    paths.sort().forEach(x=>x.reduce((
Runtime: 1446 ms\nMemory Usage: 96.1 MB\n```\nvar deleteDuplicateFolder = function(paths) {\n    var root = {}, socks = {};\n    paths.sort().forEach(x=>x.reduce((dir,v)=>dir[v]||(dir[v]={}),root));\n    function f(folder) {\n        var n = JSON.stringify(folder);\n        socks[n] = -~socks[n];\n        for (var i in folder) f(folder[i]);\n    }\n    paths = [];\n    function g(folder, p) {\n        for (var i in folder) {\n            if (socks[JSON.stringify(folder[i])]>1) {\n                delete folder[i];\n            } else {\n                var q = p.concat(i);\n                paths.push(q);\n                g(folder[i], q);\n            }\n        }\n    }\n    f(root);\n    socks[\'{}\'] = 0;\n    g(root, []);\n    return paths;\n};\n```
[]