We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 363e1c8 commit ec48434Copy full SHA for ec48434
14.longest-common-prefix.py
@@ -0,0 +1,20 @@
1
+# https://leetcode-cn.com/problems/longest-common-prefix/
2
+
3
+from typing import List
4
5
6
+class Solution1:
7
+ '''
8
+ Date: 2022.04.14
9
+ Pass/Error/Bug: 1/0/0
10
+ 执行用时: 36 ms, 在所有 Python3 提交中击败了 75.47% 的用户
11
+ 内存消耗:14.9 MB, 在所有 Python3 提交中击败了 96.39% 的用户
12
13
+ def longestCommonPrefix(self, strs: List[str]) -> str:
14
+ r = ''
15
+ for i in list(map(set, zip(*strs))):
16
+ if len(i) == 1:
17
+ r += list(i)[0]
18
+ else:
19
+ break
20
+ return r
0 commit comments