Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
yield from reversed(ascending list) solution in Clear category for Reverse Every Ascending by Phil15
#to_list = lambda f: lambda *args, **kwargs: list(f(*args, **kwargs))
#@to_list # Outputs doesn't have to be lists in "Check" tests.
def reverse_ascending(iterable):
ascending = []
for elem in iterable:
if ascending and ascending[-1] >= elem:
yield from reversed(ascending)
ascending = []
ascending.append(elem)
yield from reversed(ascending)
Dec. 5, 2018
Comments: