@@ -0,0 +1,1587 @@
+public class Trie %7B%0A    /** Initialize your data structure here. */%0A    boolean have;%0A    private class TrieNode %7B%0A        boolean have;%0A        TrieNode%5B%5D next = new TrieNode%5B26%5D;%0A%0A        public TrieNode() %7B%0A            for (int i = 0; i %3C next.length; i++) %7B%0A                next%5Bi%5D = null;%0A            %7D%0A            have = false;%0A        %7D%0A    %7D%0A%0A    private TrieNode root;%0A    public Trie() %7B%0A        root = new TrieNode();%0A    %7D%0A%0A    /** Inserts a word into the trie. */%0A    public void insert(String word) %7B%0A        TrieNode now = root;%0A        for (int i = 0; i %3C word.length(); i++) %7B%0A            int c = word.charAt(i) - 'a';%0A            if(now.next%5Bc%5D == null)%7B%0A                now.next%5Bc%5D = new TrieNode();%0A            %7D%0A            now = now.next%5Bc%5D;%0A        %7D%0A        now.have = true;%0A    %7D%0A%0A    /** Returns if the word is in the trie. */%0A    public boolean search(String word) %7B%0A        TrieNode now = root;%0A        for (int i = 0; i %3C word.length(); i++) %7B%0A            int c = word.charAt(i) - 'a';%0A            if(now.next%5Bc%5D == null)%7B%0A                return false;%0A            %7D%0A            now = now.next%5Bc%5D;%0A        %7D%0A        return  now.have;%0A    %7D%0A%0A    /** Returns if there is any word in the trie that starts with the given prefix. */%0A    public boolean startsWith(String prefix) %7B%0A        TrieNode now = root;%0A        for (int i = 0; i %3C prefix.length(); i++) %7B%0A            int c = prefix.charAt(i) - 'a';%0A            if(now.next%5Bc%5D == null)%7B%0A                return false;%0A            %7D%0A            now = now.next%5Bc%5D;%0A        %7D%0A        return now != null;%0A    %7D%0A%7D%0A

complete problem 208