Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. 实现一个字典树. 好久不做题,没感觉啊,TreeNode用一个布尔变量表示是否是一个合法单词的结尾即可,一开始还用cnt来计数,search的时候比较麻烦. class TrieNode { // Initialize your…