[Java] HashSet intuitive solution
\nclass Solution {\n    public String longestWord(String[] words) {\n       Arrays.sort(words);\n       HashSet<String> hash = new HashSet();\n       String res
```\nclass Solution {\n    public String longestWord(String[] words) {\n       Arrays.sort(words);\n       HashSet<String> hash = new HashSet();\n       String result = "";\n       for(String str : words){\n           if(str.length() == 1 || hash.contains(str.substring(0, str.length()-1))){\n               if(str.length() > result.length()) result = str;\n               hash.add(str);\n           }\n       }\n       return result;\n    }\n}\n```
['Java']