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.
- Prepare
- Data Structures
- Trie
- No Prefix Set
- Discussions
No Prefix Set
No Prefix Set
Sort by
recency
|
173 Discussions
|
Please Login in order to post a comment
Really bad problem description.
"the string being checked." means you maintain a set which is empty at first. Then you need to check (or process, or add) the word one by one".
And when you found 1. the current string is a prefix any string in the set, or 2. any string in the set is a preifx of current string
You print current string.
Test case 1 answer is 'd' is actually correct one, because you insert 'd' after you insert 'dbajkhbhbjdh' (the previous string), and right at that time, the function should determine that the word array is a BAD SET, so it should print out BAD SET d. Below are my JS code which apply Trie structure.
Why submission TestCase 1 is print "d" ? but not "dcjaichjejgheiaie"?
"dcjaichjejgheiaie" should test before "d".
Java 8 solution, passed all the tests
c++ solution