# Advent of Code 2022 - Day 3

This is a thread to discuss Day 3

REMEMBER!
It is VERY important NOT to write any public spoilers
ALWAYS keep spoiler stuff hidden inside one of these

Summary

This text will be hidden

which you can obtain by clicking on the gear icon

cool! i love the idea and no i wont tell anyone

Summary

for i in a:
b=set(i[:len(i)//2])
c=set(i[len(i)//2:])
d=list(b.intersection(c))[0]
p+=o.index(d)
p=0
for i in range(len(a)//3):
e.append(a[i*3:i*3+3])

for i in e:
t=list(set(i[0]).intersection(set(i[1]).intersection(set(i[2]))))
p+=o.index(t[0])

Flaggers

Summary

a=list(map(lambda x:x.split(","),a))
def contains(a,b):
A=list(map(int,a.split("-")))
B=list(map(int,b.split("-")))
return A[0]<=B[0] and A[1]>=B[1]
def contains(a,b):
A=list(map(int,a.split("-")))
B=list(map(int,b.split("-")))
sa=set(range(A[0],A[1]+1))
sb=set(range(B[0],B[1]+1))
return len(list(sa.intersection(sb)))>0
p=0
for i in a:
if contains(i[0],i[1]) or contains(i[1],i[0]):
p+=1

Still didn't make it to the leader board
Flaggers

Aaaaah, I'm late but finally got around to tackle day 3

Here's what I did for

part1

(this is how the data looked:

and here's

part2

Nice use of pipe and I like the early conversion to Unicode to avoid case issues