Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Iterable!!! solution in Clear category for Ascending List by juestr
from itertools import tee
from typing import Iterable
def is_ascending(items: Iterable[int]) -> bool:
try:
it1, it2 = tee(iter(items))
next(it2)
return all(x1 < x2 for x1, x2 in zip(it1, it2))
except StopIteration:
return True
Aug. 6, 2021
Comments: