fix-1 #3

Open
juliapa wants to merge 4 commits from juliapa/2025-plovdiv-testing-debugging:fix-1 into main
Showing only changes of commit 7c2448f2da - Show all commits

View file

@ -7,4 +7,14 @@ def find_maxima(x):
Output: Output:
idx -- list of indices of the local maxima in x idx -- list of indices of the local maxima in x
""" """
return [] sol = []
for idx, num in enumerate(x):
if idx == 0 and num > x[idx+1]:
sol.append(idx)
elif idx == len(x)-1 and num > x[idx-1]:
sol.append(idx)
else:
if x[idx-1] < num and num > x[idx+1]:
sol.append(idx)
return sol