14-longest-common-prefix
最大公共前缀
题目思路
这题直接暴力算就好了,先找最少的单词数, 然后进行遍历所有字符串数组, 不同直接返回当前最长前缀,相同加上前缀
go解题思路
1 | func longestCommonPrefix(strs []string) string { |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment