Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Groupby solution in Clear category for Long Repeat by amandel
from itertools import groupby
def long_repeat(line: str) -> int:
return max((len(list(g)) for x,g in groupby(line)), default=0)
print("Example:")
print(long_repeat("sdsffffse"))
assert long_repeat("sdsffffse") == 4
assert long_repeat("ddvvrwwwrggg") == 3
print("The mission is done! Click 'Check Solution' to earn rewards!")
May 21, 2023
Comments: