Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Colorful Disks by eugene100372
def count_discs(discs: tuple[int, ...]) -> int:
res,mx=0,0
for d in reversed(discs):
if d>mx:
res+=1
mx=d
return res
print("Example:")
print(count_discs((3, 2)))
# These "asserts" are used for self-checking
assert count_discs((3, 6, 7, 4, 5, 1, 2)) == 3
assert count_discs((6, 5, 4, 3, 2, 1)) == 6
assert count_discs((5,)) == 1
print("The mission is done! Click 'Check Solution' to earn rewards!")
May 17, 2024
Comments: