Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string ""
.
Example 1:
Example 2:
分析
按照长度排序 sort(key=len),取第一个str和后面所有str 按照index一个个比,第一个不等的就是最短长度
Last updated