java hashset 48ms beats 100%
\npublic class Solution {\n    public List<String> findAllConcatenatedWordsInADict(String[] words) {\n        List<String> ret = new ArrayList<>();\n        Set
```\npublic class Solution {\n    public List<String> findAllConcatenatedWordsInADict(String[] words) {\n        List<String> ret = new ArrayList<>();\n        Set<String> set = new HashSet<>();\n        for (String word : words) {\n            set.add(word);\n        }\n        for (String word : words) {\n            if (isConcatenated(set, word)) ret.add(word);\n        }\n        return ret;\n    }\n    \n    private boolean isConcatenated(Set<String> set, String s) {\n        for (int i = 1; i < s.length(); i++) {\n            if (set.contains(s.substring(0, i))) {\n                String rightStr = s.substring(i);\n                if (set.contains(rightStr) || isConcatenated(set, rightStr))\n                    return true;\n            }\n        }\n        return false;\n    }\n}\n```
[]