r/adventofcode • u/daggerdragon • Dec 03 '15
SOLUTION MEGATHREAD --- Day 3 Solutions ---
--- Day 3: Perfectly Spherical Houses in a Vacuum ---
Post your solution as a comment. Structure your post like the Day One thread in /r/programming.
24
Upvotes
View all comments
Show parent comment
3
u/minno Dec 03 '15
You could speed this up significantly by using a set instead of a list. Just change
visitedHouses=[(0,0)]intovisitedHouses=set(); visitedHouses.add((0,0))andvisitedHouses.append((x,y))withvisitedHouses.add((x,y)).