update project structure

This commit is contained in:
2024-06-20 06:29:07 +08:00
parent 17b4ef8970
commit fdaa94a0fa
49 changed files with 35 additions and 4 deletions

19
leetcode_py/14.py Normal file
View File

@@ -0,0 +1,19 @@
# find the longest common prefix
# 1 <= strs.length <= 200
# 0 <=strs[i].length <= 200
# only lowercase
class Solution:
def longestCommonPrefix(self, strs: list[str]) -> str:
return_string = ""
i = 0
while i < len(strs[0]):
try:
for string in strs:
if string[i] != strs[0][i]:
return return_string
return_string += strs[0][i]
i += 1
except:
return return_string
return return_string