We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd720cf commit 117bd23Copy full SHA for 117bd23
1 file changed
LeetCode/longestCommonPrefix.py
@@ -0,0 +1,13 @@
1
+class Solution:
2
+ def longestCommonPrefix(self, strs):
3
+ """
4
+ :type strs: List[str]
5
+ :rtype: str
6
7
+ if len(strs) == 0:
8
+ return ''
9
+ s = strs[0]
10
+ for i in strs[1:]:
11
+ while s != i[:len(s)]:
12
+ s = s[:-1]
13
+ return s
0 commit comments