this post was submitted on 15 Nov 2023
12 points (100.0% liked)

Advent Of Code

763 readers
1 users here now

An unofficial home for the advent of code community on programming.dev!

Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

AoC 2023

Solution Threads

M T W T F S S
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25

Rules/Guidelines

Relevant Communities

Relevant Links

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

console.log('Hello World')

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 11 months ago* (last edited 11 months ago) (1 children)

exponential growth trap?

what is that?

[–] [email protected] 2 points 11 months ago (1 children)

An X^n operation. A funtion that requires more calculations as it's input grows. Google for "Big O notation". The ideal is a Big O of 1, which means that regardless of the input, the funtion takes the same time to run. This a print statement for example.

This puzzle was designed so that the first part is relatively easy to solve, but the second part has bigger input where the exponential growth kicks in and it becomes computationally unsolvable. So you have to rewrite the function and group the input in a different way to avoid make the funtcion run in N^2 time instead of X^n (which is faster and requires less resources)

[–] [email protected] 2 points 11 months ago

So, what you're saying is not to iterate thru every fish, but group the fish in 9 groups depending on age, meaning it will only make 9 tests no matter if there are 1 or 3billion fish?