def longest_common_prefix(words: List[str]) -> str: common_prefix = "" shortest_word = min(words, key=len) length_shortest_word = len(shortest_word) for index in range(length_shortest_word): for word in words: if shortest_word[index] != word[index]: return common_prefix common_prefix += shortest_word[index] return common_prefix