Trie Tree + hash
\nclass Trie{\n        Map<String, Trie> children;\n        boolean leaf;\n        boolean del;\n        Trie(){\n            children = new TreeMap<>();\n     
```\nclass Trie{\n        Map<String, Trie> children;\n        boolean leaf;\n        boolean del;\n        Trie(){\n            children = new TreeMap<>();\n        }\n        void insert(List<String> word){\n            Trie root = this;\n            for (String c : word){\n                root = root.children.compute(c, (k, v) -> v == null ? new Trie() : v);\n            }\n            root.leaf = true;\n        }\n        Trie next(String c){\n            return this.children.get(c);\n        }\n}\n\nclass Solution {\n    \n    public List<List<String>> deleteDuplicateFolder(List<List<String>> paths) {\n        Trie t = new Trie();\n        for (List<String> path : paths){\n            t.insert(path);\n        }\n        Map<String, Trie> map = new HashMap<>();\n        dfs(t, map);\n        List<List<String>> ans = new ArrayList<>();\n        travel(t, new ArrayList<>(), ans);\n        return ans;\n    }\n    String dfs(Trie t, Map<String, Trie> map){\n        if (t == null){\n            return "";\n        }\n        StringBuilder sb = new StringBuilder();\n        for (Map.Entry<String, Trie> entry : t.children.entrySet()){\n            String s = entry.getKey()+ ","+ dfs(entry.getValue(), map);\n            sb.append("(" + s + ")");\n        }\n        if (sb.toString().length() > 0 && map.containsKey(sb.toString())){\n            t.del = true;\n            map.get(sb.toString()).del = true;\n        }else{\n            map.put(sb.toString(), t);\n        }\n        return sb.toString();\n    }\n    void travel(Trie t, List<String> path, List<List<String>> ans){\n        if (t == null || t.del){\n            return;\n        }\n        if (path.size() > 0){\n            ans.add(new ArrayList<String>(path));\n        }\n        for (Map.Entry<String, Trie> entry : t.children.entrySet()){\n            path.add(entry.getKey());\n            travel(entry.getValue(), path, ans);\n            path.remove(path.size() - 1);\n        }\n    }\n}\n```
[]