Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution(object):
- def longestCommonPrefix(self, strs):
- """
- :type strs: List[str]
- :rtype: str
- """
- result = ""
- if len(strs) == 0:
- return ""
- for i in range(len(strs[0])):
- char = strs[0][i]
- for str in strs:
- if len(str) < i+1 or char != str[i]:
- return result
- result = result + char
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement