From 47bfab928a81e6529c9e667a84d63637e5a1c597 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Tue, 6 Dec 2022 18:02:00 +1030 Subject: [PATCH] 2022 Day 6 Python benching (twice as fast as scala!) --- 2022/day6-bench.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 2022/day6-bench.py diff --git a/2022/day6-bench.py b/2022/day6-bench.py new file mode 100644 index 0000000..2aecc36 --- /dev/null +++ b/2022/day6-bench.py @@ -0,0 +1,11 @@ +l=open('input/6','r').read() +def s(n,skip=0): + for i in range(max(skip, n),len(l)): + if len(set(l[i-n:i]))==n: + return i + +for i in range(100000): + four = s(4) + fourteen = s(14, four) +print(four) +print(fourteen)