Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def day1(s, *, part2=False):
- columns = np.array([line.split() for line in s.splitlines()], int).T
- if not part2:
- return abs(np.diff(np.sort(columns), axis=0)).sum()
- counts = collections.Counter(columns[1])
- return sum(value * counts[value] for value in columns[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement