Question
Write a function to find the longest common prefix string amongst an array of strings.
input
string[]
output
string
Solution
因为是公共子串,显然有
|
|
因此我们先将第一个字符串设为最长公共前缀S,再将S与下一个字符串进行比较。
code
|
|
Write a function to find the longest common prefix string amongst an array of strings.
string[]
string
因为是公共子串,显然有
|
|
因此我们先将第一个字符串设为最长公共前缀S,再将S与下一个字符串进行比较。
|
|
近期评论