Skip to content

Commit

Permalink
Solve day 5 part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mjalkio committed Dec 25, 2023
1 parent ea0fe31 commit b159e86
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions year_2023/day05/if_you_give_a_seed_a_fertilizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def get_lowest_location_number(puzzle_input, use_ranges=False):
start=m_range.source_range.end, end=s_range.end
)
map_idx += 1
while seed_idx < len(seed_ranges):
new_seed_ranges.append(seed_ranges[seed_idx])
seed_idx += 1

new_seed_ranges.sort()
seed_ranges = new_seed_ranges
return min(s_range.start for s_range in seed_ranges)
Expand Down

0 comments on commit b159e86

Please sign in to comment.