Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple solution in Clear category for Long Repeat by amandel
def long_repeat(line: str) -> int:
last=''
cur=big=0
for x in line:
if x == last:
cur+=1
else:
big=max(big,cur)
last=x
cur=1
return max(big,cur)
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: