Tuesday, March 22, 2016

LeetCode 刷题第一阶段 Longest Common Prefix

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

=================================================================

2个loop check.  easy.  更好的解法可参考trie. 时间复杂度更低但是code实现起来太麻烦。。此处不用。

CODE:

No comments:

Post a Comment