From df55eec6d8a0adb84c61f4cb47e26e4a032009f3 Mon Sep 17 00:00:00 2001 From: setop Date: Sun, 3 Dec 2023 01:52:05 +0100 Subject: [PATCH] day 10, easy with itertools.groupby part 2 scales thanks to codon --- d10/run.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 d10/run.py diff --git a/d10/run.py b/d10/run.py new file mode 100644 index 0000000..188dcc5 --- /dev/null +++ b/d10/run.py @@ -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)) \ No newline at end of file