We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
We are build a Trie. Each TrieNode has children. For example, the TrieNode C, can have children A, O, U.
children.putIfAbsent() only puts another child for C if that child does not already exist. So if we put I, it will put it. However, if we try putting A, it will not put it as A is already in children.
Contacts
You are viewing a single comment's thread. Return to all comments →
We are build a Trie. Each TrieNode has children. For example, the TrieNode C, can have children A, O, U.
children.putIfAbsent() only puts another child for C if that child does not already exist. So if we put I, it will put it. However, if we try putting A, it will not put it as A is already in children.
HackerRank solutions.