2022-2023/1NSI/Evaluations/DS_2023-03-31/annexes/sous_liste1.py

10 lines
242 B
Python

def pgsp(lst:list):
n = len(lst)
somme_max = lst[0]
for i in range(n):
for j in range(i, n):
s = somme_sous_sequence(lst, i, j)
if s > somme_max :
somme_max = s
return somme_max