JAVA || Easy Solution || 100% Faster Code
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass WordDictionary {\n  class TrieNode {\n    boolean isWord;\n    TrieNode[] children;\n    \n    public TrieNode() {\n      isWord = false;\n      children = new TrieNode[26];\n    }\n  }\n  \n  TrieNode root;\n\n  public WordDictionary() {\n    root = new TrieNode();\n  }\n\n  /**\n   * Time Complexity: O(n)\n   * Space Complexity: O(n)\n   */\n  public void addWord(String word) {\n    TrieNode node = root;\n    /**\n     * Time Complexity: O(n)\n     *   - word length\n     * Space Complexity: O(n)\n     *   - word length\n     */\n    for (int i = 0; i < word.length(); i++) {\n      int idx = word.charAt(i) - \'a\';\n      if (node.children[idx] == null) {\n        /**\n         * Space Complexity: O(1)\n         *   - Always 26 lower-case English letters\n         */\n        node.children[idx] = new TrieNode();\n      }\n      node = node.children[idx];\n    }\n    node.isWord = true;\n  }\n\n\n  /**\n   * Time Complexity: O(n)\n   * Space Complexity: O(n)\n   */\n  public boolean searching(String word, TrieNode node, int wordIdx) {\n    if (node == null) return false;\n    /**\n     * Time Complexity: O(n)\n     *   - word length\n     */\n    for (int i = wordIdx; i < word.length(); i++) {\n      int idx = word.charAt(i) - \'a\';\n      // (\'.\' - \'a\') = -51\n      if (idx == (-51)) {\n        /**\n         * Time Complexity: O(1)\n         *   - Always 26 lower-case English letters\n         */\n        for (int j = 0; j < node.children.length; j++) {\n          /**\n           * Space Complexity: O(n)\n           *   - stack: if search \'.\' for whole letters.\n           */\n          if (searching(word, node.children[j], i + 1)) {\n            return true;\n          }\n        }\n        return false;\n      }\n      if (node.children[idx] == null) return false;\n      node = node.children[idx];\n    }\n    return node.isWord;\n  }\n\n  public boolean search(String word) {\n    return searching(word, root, 0);\n  }\n}\n```
['Java']