NERD SHIT :marseynerd: ADVENT OF CODE 10 M=E=G=A=T=H=R=E=A=D

LET'S SAVE THOSE ELVES, BROS

Okay it isn't even out yet, I'm sure it will be great, and the elves are in trouble, etc. I'm just beating you all to the bunch so I can tell you to explain your answers, we care about ALGORITHMIC COMPLEXITY now. What's the fastest and most efficient way to do it.

heymoon wtf is a big o

This is O(n)

x = REALLY_BIG_NUMBER
for i in range(x):
    process(i)

This is O(n^2)

x = REALLY_BIG_NUMBER
for i in range(x):
    for j in range(x)
        process(i,j)

There's more to it but that's the quick version. Also there are things like O(log(n)) (based), O(a^n) (cringe), and O(n!) (advanced cringe).

Okay, post ur code too but explain why its cool or no one will read it. I'll pin my favorite answers, other mods also do this

LET'S SAVE THOSE ELVES, BROS

42
Jump in the discussion.

No email address required.

it got the extended test case perfect, so idkwtf is going on.

no, i will not fix it mangling the first letter and no, i will not discuss big o.

![](/images/16706625190892649.webp)

Jump in the discussion.

No email address required.

...i don't see the issue? Its bzgraza?

Jump in the discussion.

No email address required.

my (and im guessing everyones) answer was meant to be 8 letters, not 7. i spent way too long sifting through print statements trying to understand why it was mangled and gave up because the test was fine. :#marseytabletired2:

Jump in the discussion.

No email address required.

I had the same issue lol, it looks like someone already told you what the issue is. I was using binary to create the line, so what I did was have the initial (at 1) be

sprite = 0b11100

instead of

sprite = 0b111

and then shift it left by two bits every time I needed to use it :marseybigbrain:

Jump in the discussion.

No email address required.

i quickly wrote out the revelant parts because i was bored and it seems that your sprite variable is sometimes bigger than it should be:

![](/images/16706877401108322.webp)

That seems to happen mainly if the register is negative or >= 40. Honestly quite bizarre that this bug still makes it almost work. For my input it only turns the first R into a B:

![](/images/1670687797080689.webp)

Jump in the discussion.

No email address required.

it was actually a P. i tried R and it told me to hang myself.

oh im r-slurred i didnt read your comment. but yeah, i figured long lines wouldnt matter since theyre 0 indexed, but maybe theyre getting shifted oddly by the fstring or something.

Jump in the discussion.

No email address required.

The problem is that your sprite sometimes is:

###....................................... when it should be:

#.......................................

So if it cc == 2 and it tries to access sprite[cc] it gets a # instead of the .. The same issue exists on the other end, but there it doesnt matter, since it would never access that part of the sprite anyway.

You should be able to fix it by doing sth like: {"#" * (40 - max(dots_to_the_left, 0) - max(dots_to_the_right, 0)}

This also explains why the test works fine, the bug only happens in the first and second column and those are "#" by default

Jump in the discussion.

No email address required.

very smort :marseynotes:

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.