public static ArrayList<String> findLongestWord(String[] words) {
        if (words == null) return null;
        sortWordsByLength(words);
        ArrayList<String> result = new ArrayList<String>();
        HashMap<String, Boolean> map = new HashMap<String, Boolean>();
        for (String word : words) {
            map.put(word, true);
        }
        int maxLen = 0;
        for (String word : words) {
            if (isValidWord(word, true, map) && word.length() >= maxLen) {
                result.add(word);
                maxLen = word.length();
            }
        }
        return result;
    }