• abbadon420@lemm.ee
    link
    fedilink
    arrow-up
    6
    ·
    1 year ago

    https://adventofcode.com/2021/day/6

    This was my first real attempt at a harder puzzle. I was just finishing my springboot course and, of course, fell for the exponential growth trap. Only I didn’t realize exponential growth was the problem. So, I set up a database and a springboot application, like I had just learned. I believe I did get a result, but it took about 10 hours or so.

    Good times!

    Eventually this puzzle became the pitch how I got my current job.

      • abbadon420@lemm.ee
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        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)

        • UnRelatedBurner@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          1 year 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?

  • tranzystorek_io@beehaw.org
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    Oh boy, how can i forget 2019 and the whole series of “intcode” challenges!

    You had a growing specification of a sorta-pcode virtual computer, opcodes, etc. Your input was the titular intcode, a list of integers representing instructions and you had to execute that code and use that execution to solve the bigger challenge, e.g. play a simple one-sided Pong!

  • sleep_deprived@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    In 2019 there was a series of problems where had you make an interpreter for a bytecode they made up. Intcode I think. I really like programming languages and that kind of stuff so those were great for me.