Data Structure & Algorithm: Level-1 Problem #24. Common Prefix

Given a list of words, find out the longest common prefix among them. If there is no common prefix, return an empty string.

Sample Input:

integer, integrity, integrate, interim

Sample Output:

inte


数据结构和算法:初级练习题 #24 – 相同前缀


给定一组词汇,找出最长相同前缀。如果没有相同前缀则返回空字符串。

输入样例:

integer, integrity, integrate, interim

输出样例:

inte


Python Solution

Common Prefix