Skip to content

Commit

Permalink
2024, day 5, part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
BioGeek committed Dec 5, 2024
1 parent d135733 commit a4339f0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions 2024/day05.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ def in_right_order(update, ordering_rules):


def order(update, ordering_rules):
print(update)
for n in update:
print(n, ordering_rules[n])
return sorted(update, key=lambda n: len(ordering_rules[n]), reverse=True)
return sorted(
update,
key=lambda n: len(set(i for i in ordering_rules[n] if i in update)),
reverse=True,
)


def middle_page_number(protocol, part=1):
Expand Down

0 comments on commit a4339f0

Please sign in to comment.