Amazon onsite || OOD || AutoComplete
Anonymous User
2821

Implement operations for an AutoComplete feature.

  1. InsertWords(words) - Given a stream of words, store the words
  2. CheckPrefix(prefix) - Returns if the prefix exists
  3. SearchPrefix(prefix) Given a prefix string, return words starting with the prefix string.
    Eg: Insert Words {car, cart, carpool, bus, apple, cargo}
    SearchPrefix (car) -> car, cart, carpool, cargo
    Follow up questions – SearchPrefix() return in sorted order/ top k results
Comments (6)