Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
[While Loop and Compare] [Two Pointers] [Speedy and Clear] solution in Speedy category for Colorful Disks by sanddro
def count_discs(discs: tuple[int, ...]) -> int:
i = len(discs) - 1
j = i - 1
count = 1
while j >= 0:
if discs[j] > discs[i]:
count += 1
i = j
j -= 1
return count
Jan. 19, 2025
Comments: