We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Longest Common Prefix

Let's use our Trie to find the longest common prefix of a list of words. This feature can be used in LockedIn to display suggestions when users are searching for their connections.

Assignment

Complete the longest_common_prefix method. It returns the longest common prefix among the words in the trie.

Tips

  1. You can access just the keys of a dictionary with the .keys() method.
  2. Here's the syntax for an intentional infinite loop. Always remember to include an exit condition so it doesn't actually continue forever.
while True:
    if exit_condition == True:
        break