aoc-2021-day6

mail@pastecode.io avatar
unknown
python
2 years ago
365 B
179
Indexable
Never
def population(init_state, time):
    state_count = [init_state.count(i) for i in range(0, 9)]
    for _ in range(0, time):
        state_count = state_count[1:] + state_count[:1]
        state_count[6] += state_count[8]
    return sum(state_count) 


def part1(data):
    return population(data, 80)


def part2(data):
    return population(data, 256)