Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def day9(s, *, part2=False):
- def f(a):
- return 0 if not any(a) else a[0] - f(np.diff(a)) if part2 else a[-1] + f(np.diff(a))
- return sum(f(np.array(line.split(), int)) for line in s.splitlines())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement