day 10, easy with itertools.groupby

part 2 scales thanks to codon
This commit is contained in:
setop 2023-12-03 01:52:05 +01:00
parent 199bc88505
commit df55eec6d8
1 changed files with 7 additions and 0 deletions

7
d10/run.py Normal file
View File

@ -0,0 +1,7 @@
import sys
from itertools import groupby as gb
r = sys.argv[1]
for _ in range(int(sys.argv[2])):
r = "".join(f'{n}{c}' for c,n in map(lambda x: (x[0],len(list(x[1]))), gb(r)))
print(len(r))