advent-of-code/2016-python2/output
Anders Englöf Ytterström 39e09dd36e Solve 2016:19 p1-2 "An Elephant Named Joseph"
Learned a lot about the Josephus' Problem today!

Solved part 1 by using a dict, but eventually
ended up just adding the mathematical shortcut
and rewriting both parts to use deque() for
performance.

Part 2 was tricky, since k (the elf to remove
after all presents were stolen from them) is a
index that changes over time. No tries for a
solution that was performant enough using lists
and dicts were succesfull, so by inspiration from
the subreddit the final solution code is based on
2 deque() that pops and appends between them.

There are 2 part 1 solutions.

- A correct implementation of the Josephus' Problem,
  using deque(). Recursion would have worked as well,
  but Python do not like recursions.
- The mathematical superior version, with a link
  to the Youtube video were it is introduced.
2024-12-12 13:53:43 +01:00
..
__init__.py Solve 2016:17 p1-2 "Two Steps Forward" 2024-12-12 13:53:43 +01:00
day_11.py Simplify scaffold code 2024-12-12 13:53:43 +01:00
day_12.py Simplify scaffold code 2024-12-12 13:53:43 +01:00
day_13.py Simplify scaffold code 2024-12-12 13:53:43 +01:00
day_14.py Simplify scaffold code 2024-12-12 13:53:43 +01:00
day_15.py Simplify scaffold code 2024-12-12 13:53:43 +01:00
day_16.py Simplify scaffold code 2024-12-12 13:53:43 +01:00
day_17.py Solve 2016:17 p1-2 "Two Steps Forward" 2024-12-12 13:53:43 +01:00
day_18.py Solve 2016:18 p1-2 "Like a Rogue" 2024-12-12 13:53:43 +01:00
day_19.py Solve 2016:19 p1-2 "An Elephant Named Joseph" 2024-12-12 13:53:43 +01:00