Im trying to solve this challenge:
Given a list of names. The list is considered consistent if no name is a prefix of another name. That means that no
name begins with the same sequence of letters that makes up another whole name.
Write a program that reads a list of names from the standard input and writes to the standard outputs the value
“true” if the list is consistent or the value “false” if the list is not considered consistent. The names are made of the
lower cases characters from a to z.
Suffix string list
hello @leoengufmg
put all these given string in trie.
and check whether there exist more than one ending terminal in some path from root to leaf node or not.
What is the big O for this procedure?
it will be summation of lengths of all given string.
i,e O( summation ( length of all given string) )
Thank you very much, it works!
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.