Advent of Code Solutions
I have set myself a personal challenge to try and get up to date with advent of code, a set of programming challenges released each December. Each day has 2 related problems, for a total of 50 problems per year. Each button below will show my code solving that problem. Green buttons where I have solved both problems of the day, orange where I have only solved the first one and red where I haven't solved either. Not started
Part 1 completed
Both parts completed
from util.input import get_input
def part_1():
puzzle_input = int(get_input(2015, 20).strip())
trial_houses = 1000000
houses = [10] * trial_houses
for i in range(1,trial_houses):
for j in range(i, trial_houses, i+1):
houses[j] += (i+1)*10
for i in range(trial_houses):
if houses[i] >= puzzle_input:
break
return i+1
def part_2():
puzzle_input = int(get_input(2015, 20).strip())
trial_houses = 1000000
houses = [11] * trial_houses
for i in range(1,trial_houses):
for j in range(50):
next_ind = i + ((i+1)* j)
# hopefully we've caught the answer by now
if next_ind >= trial_houses:
break
houses[next_ind] += (i+1)*11
for i in range(trial_houses):
if houses[i] >= puzzle_input:
break
return i+1