Day 06 (minified)

This commit is contained in:
Sebastian Seedorf
2022-12-08 11:33:21 +01:00
parent c476f87437
commit b61471f365
3 changed files with 3 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ for line in lines:
next(lines) next(lines)
for line in lines: for line in lines:
a, s, t = map(int, re.search(r"move (\d+) from (\d+) to (\d+)", line).groups()) a, s, t = map(int, re.search(r"move (\d+) from (\d+) to (\d+)", line).groups())
stacks[t-1] = stacks[s-1][:a][::-1]+stacks[t-1] stacks[t-1] = stacks[s-1][:a]+stacks[t-1]
stacks[s-1] = stacks[s-1][a:] stacks[s-1] = stacks[s-1][a:]
print(''.join(i[0] for i in stacks)) print(''.join(i[0] for i in stacks))

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
print(next(i+4for l in open("input.txt")for i in range(len(l))if len(set(l[i:i+4]))==4)) print(next(i+4for l in open("input.txt")for i in range(len(l))if len({*l[i:i+4]})==4))

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
print(next(i+14for l in open("input.txt")for i in range(len(l))if len(set(l[i:i+14]))==14)) print(next(i+14for l in open("input.txt")for i in range(len(l))if len({*l[i:i+14]})==14))