Interview Question

Interview Seattle, WA

How would you find if a list of strings, at least one is a

  prefix of another?

Interview Answer

1 Answer


Construct a Radix Tree. Stop when you find a prefix in the tree (i.e., want to extend a leaf node), or the string being added is contained in the tree.

Interview Candidate on Jan 19, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.