Algos
Overview
Each problem is a standalone Python module under algos/, named NNNN.py
(zero-padded, starting at 0001), with three regions:
- PROBLEM — the instructions docstring, then any scaffolding code the problem hands you.
- SOLUTION — the working implementation. Fold this to re-solve the problem.
- TESTS — pytest cases plus a
__main__runner, sopython3 NNNN.pyruns that problem's tests on its own.
Use cmd + shift + [ to fold all regions. The problem name lives in the link
text below and in the first line of the module's instructions.
Run python3 scripts/algos_to_apple_notes.py to push every problem into the
Algos folder in Apple Notes. Each note is sectioned by the same marker
style — --- PROBLEM ---, --- GIVEN CODE ---, --- SOLUTION BELOW --- —
with a screen of blank space before the solution, far enough down that you
can't spoil yourself by accident.
Turn Math Results off in Notes (Notes → Settings → uncheck Insert results
automatically), or Notes reads assignment lines like self.head = new_node
as equations and reformats them — colored variables, . shown as ×.