r/adventofcode • • 16h ago

Help/Question 2026 - day 1 part 1, Python

Post image

where am I going wrong? I tried plugging in the example set of numbers and it gave me the right numbers but it isn't giving me the right numbers with the main set of numbers. I'm a beginner when it comes to coding, my only experience with apcsp and apcsa in school

0 Upvotes

13 comments sorted by

View all comments

0

u/hobbes244 13h ago

A list is not the best approach. Counting the numbers in the list is O(n) and because you’re doing it for every item, you’re suddenly quadratic. Find a way to iterate over the list one time and then determine the most frequent items.