25 lines
583 B
Python
25 lines
583 B
Python
# HumanEval/9
|
|
# Loki Mode Multi-Agent Solution
|
|
# Attempts: 1
|
|
# Passed: True
|
|
|
|
from typing import List, Tuple
|
|
|
|
|
|
def rolling_max(numbers: List[int]) -> List[int]:
|
|
""" From a given list of integers, generate a list of rolling maximum element found until given moment
|
|
in the sequence.
|
|
>>> rolling_max([1, 2, 3, 2, 3, 4, 2])
|
|
[1, 2, 3, 3, 3, 4, 4]
|
|
"""
|
|
if not numbers:
|
|
return []
|
|
|
|
result = []
|
|
current_max = numbers[0]
|
|
|
|
for num in numbers:
|
|
current_max = max(current_max, num)
|
|
result.append(current_max)
|
|
|
|
return result |