cache monie
This commit is contained in:
@@ -16,7 +16,15 @@ def part1():
|
||||
print("Part 1 %d " % (diffs[1] * diffs[3]))
|
||||
|
||||
|
||||
cache = {
|
||||
|
||||
}
|
||||
|
||||
|
||||
def count_options(og, adapters):
|
||||
if og in cache:
|
||||
return cache[og]
|
||||
|
||||
amount = 0
|
||||
adap = list.copy(adapters)
|
||||
|
||||
@@ -29,6 +37,7 @@ def count_options(og, adapters):
|
||||
break
|
||||
amount += count_options(num, adap)
|
||||
|
||||
cache[og] = amount
|
||||
return amount
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user