Day 1 (part 2 bugfix)
This commit is contained in:
@@ -9,7 +9,7 @@ tree = dict()
|
|||||||
def tree_up(idx, step=1, offset=0):
|
def tree_up(idx, step=1, offset=0):
|
||||||
nxt = tree[(idx, step)] if (idx, step) in tree else None
|
nxt = tree[(idx, step)] if (idx, step) in tree else None
|
||||||
appendix = [] if nxt is None else tree_up(nxt+idx, step=step+1, offset=idx)
|
appendix = [] if nxt is None else tree_up(nxt+idx, step=step+1, offset=idx)
|
||||||
return [idx - offset] + appendix
|
return [idx-offset] + appendix
|
||||||
|
|
||||||
|
|
||||||
def prod(iterable):
|
def prod(iterable):
|
||||||
@@ -28,10 +28,8 @@ for item in items:
|
|||||||
prod(vals)
|
prod(vals)
|
||||||
))
|
))
|
||||||
exit()
|
exit()
|
||||||
elif new[0] < 0 or new[1] < 0:
|
elif new[0] > 0 and new[1] > 0:
|
||||||
# target value too low or to many sums
|
if new not in tree:
|
||||||
pass
|
|
||||||
else:
|
|
||||||
tree[new] = item
|
tree[new] = item
|
||||||
tmp_values.add(new)
|
tmp_values.add(new)
|
||||||
values = tmp_values
|
values = tmp_values
|
||||||
|
|||||||
Reference in New Issue
Block a user