mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-07 10:50:36 +00:00
urgent commit
This commit is contained in:
13
recherche/main.py
Normal file
13
recherche/main.py
Normal file
@@ -0,0 +1,13 @@
|
||||
if __name__ == "__main__":
|
||||
liste1 = [12,1,20,5,23,8,29,10]
|
||||
liste2 = [23,5,19,11,18,20,29,1,5,10,8]
|
||||
|
||||
def recherche_naive(l1, l2):
|
||||
if not l1 or not l2:
|
||||
return []
|
||||
if l1[0] == l2[0]:
|
||||
return [l1[0]] + recherche_naive(l1[1:], l2[1:])
|
||||
else:
|
||||
seq1 = recherche_naive(l1[1:], l2)
|
||||
seq2 = recherche_naive(l1, l2[1:])
|
||||
return seq1 if len(seq1) >= len(seq2) else seq2
|
||||
Reference in New Issue
Block a user