class Solution:
# @return a string
def longestCommonPrefix(self, strs):
if len(strs) == 0:
return ""
for i in range(len(strs[0])):
for j in range(len(strs)):
if len(strs[j]) <= i or strs[j][i] != strs[0][i]:
return (strs[0])[0 : i]
return strs[0]
Friday, September 12, 2014
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment