Day 18
Still in London today - but the puzzle was very very very fun! Second favourite, right after day 8 :D I wrote a non-recursive program.
The key to solving this problem fast was to choose a smart way of representing the data. I saw some binary tree implementations which worked well, and also a creative one using complex numbers keeping track of the value and the depth, but I personally did something a little more unique. I initially converted each line of the input to a list, simply using list(). This split the line at each character - meaning I could deal with 'blocks' throughout the puzzle, and I would know exactly how the blocks would be arranged. If I did not do this, some numbers would be more than 1 character long as the program ran and I would have to deal with all of the edge cases. This ultimately allowed for a relatively quick Part 1 implementation - the nooks and crannies of which I'll let you explore!
Part 2 was [thank god] a simple edit of using itertools.permutations and running the process on each permutation to find the maximum result - my code runs in about 4 seconds. Either way, I really enjoyed today's puzzle!
Can't believe that took an hour...