Longest Common Prefix

来源:互联网 发布:新浪微博数据统计工具 编辑:程序博客网 时间:2024/05/23 09:53

题目: Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.

题意:求所有字符串的最长公共前缀

想法:每个字符串都有同样的一个公共前缀,求最长的那个,从字符串容器中取第一个字符串将其每一个字符与其后的字符串依次进行对比即可,本题最后时间复杂度也能够通过,比较简单,属于基础的字符串处理题。


0 0