难度:简单
一、题目描述:
二、解题分析:
1、水平扫描
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
if len(strs) == 0:
return ''
s = strs[0]
for i in range(1, len(strs)):
while strs[i].find(s) != 0 :
s = s[:-1]
return s
2、垂直扫描
class Solution:
def
难度:简单
一、题目描述:
二、解题分析:
递归是一个很直接的方法,想想斐波那契数列
from typing import List
###### leetcode 代码主体 ######
class Solution:
def mergeTwoLists(self, l1, l2):
if l1 is None:
return l2
elif l2 is None:
return l1