From eb14bebf4cd6876915388a9f9f210d50fe1f655f Mon Sep 17 00:00:00 2001 From: Jake Pullen Date: Tue, 5 Dec 2023 08:30:03 +0000 Subject: [PATCH] Optimize seed number search and print answer --- 2023/day_5/part 2 solution.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/2023/day_5/part 2 solution.py b/2023/day_5/part 2 solution.py index 82bd693..ff008f2 100644 --- a/2023/day_5/part 2 solution.py +++ b/2023/day_5/part 2 solution.py @@ -8,6 +8,15 @@ with open(r'advent_of_code\2023\day_5\test_input.txt', 'r') as file: # print(input) +# big fat read me note +# big fat read me note +# big fat read me note +# this has a VERY LONG run time due to looping through what is probably millions of numbers +# JP to come back later and try to optimize this +# big fat read me note +# big fat read me note +# big fat read me note + # find the seed numbers seed_numbers = input[0].split(':')[1].strip().split(' ') #print(seed_numbers) @@ -64,8 +73,9 @@ for seed in seed_map: # Update smallest_location if a smaller location is found if location < smallest_location: smallest_location = location + print(smallest_location) # Print the smallest location -print(smallest_location) +print(f'answer: {smallest_location}')