src/main/java/com/leetcode/design/medium/ImplementTriePrefixTree_208.java
public void insert(String word) {

      TrieNode curr = head;
      for (char c : word.toCharArray()) {
        if (curr.children[c - 'a'] == null) {
          curr.children[c - 'a'] = new TrieNode();
        }
        curr = curr.children[c - 'a'];
      }
      curr.isWord = true;
    }
/** Inserts a word into the trie. */
Inserts a word into the trie.
Inserts a word into the trie .
public void insert(String word) {
      TrieNode curr = head;
      for (char c : word.toCharArray()) {
        if (curr.children[c - 'a'] == null) {
          curr.children[c - 'a'] = new TrieNode();
        }
        curr = curr.children[c - 'a'];
      }
      curr.isWord = true;
    }
public void insert ( String word ) { TrieNode curr = head ; for ( char c : word . toCharArray ( ) ) { if ( curr . children [ c - 'a' ] == null ) { curr . children [ c - 'a' ] = new TrieNode ( ) ; } curr = curr . children [ c - 'a' ] ; } curr . isWord = true ; }
Inserts a word into the trie.
Inserts a word into the trie .