...
| Code Block | ||
|---|---|---|
| ||
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
if not strs:
return ""
result=""
cnt=len(strs)
for i in range(len(strs[0])):
j=1
while j<cnt and i<len(strs[j]) and strs[j][i]==strs[0][i]: j+=1
if j==cnt:
result += strs[0][i]
else:
break;
return result; |
Longest Palindromic Substring
| Info |
|---|
Input: "babad" → Output: "bab" Input: "cbd" → Output: "bb" |
...