Skip to content

Commit

Permalink
day12: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ong committed Dec 24, 2023
1 parent 2cc2b41 commit 60da55c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions day12/day12.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ def set_and_return(self, state: State, value: int) -> int:
return value

def calculate_recursive(self, state: State) -> int:
"""
Recursive with memoization
1. memoized
2. state.empty -> return if we are valid
3. state[0] == "." chop it and continue
4. state[0] == "#". get next number, and "enforce" it, chopping things. If anything is wrong, fail
"""
if state in self.big_cache:
return self.big_cache[state]
if len(state.items) == 0:
Expand Down

0 comments on commit 60da55c

Please sign in to comment.