For the first part, I used itertools.combinations to find the highest pairs of batteries. And as expected, that solution did not scale well for pt 2. I figured out that reducing batteries until the top most 12 (and 2) remained was the correct way to go. the _maxj(line, C) function is the hive conclusion from the solution mega thread. I really liked this brilliant use of a while loop to exlude batteries. - The first char just skip the while loop. A char emptying the battery list also does this. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| day_01.py | ||
| day_02.py | ||
| day_03.py | ||