public static void addWord(TrieNode n, String word) {
        if (word == null || word.isEmpty()) return;
        char[] characters = word.toCharArray();
        for (char ch: characters) {
            if (!n.children.containsKey(ch)) {
                n.children.put(ch, new TrieNode(ch));
            }
            n = n.children.get(ch);
        }
        n.isWord = true;
    }