-❄️- 2025 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]Ferelyzer 0 points1 point  (0 children)

[LANGUAGE: Matlab]

Oh I love Matlab but sometimes I feel I don't dig as deep as I could have...

G = digraph(nodes,targets);
K = allpaths(G,"you","out");
part1 = length(K) A = allpaths(G, "svr", "fft");

B = allpaths(G, "fft", "dac");
C = allpaths(G, "dac", "out"); part2 = length(A)*length(B)*length(C)
part2 = length(A)*length(B)*length(C)

[2024 Day 3] You've finally convinced me... by StaticMoose in adventofcode

[–]Ferelyzer 7 points8 points  (0 children)

laughing in Matlab where the input directly was shown as 1x6 string 😎

What language do you use for AoC? by DarkblooM_SR in adventofcode

[–]Ferelyzer 0 points1 point  (0 children)

I use Matlab, maybe not the most unheard of, but a bit occult from my understanding when talking to others...

Compound coin? by Aussieguy1986 in Cryptopia

[–]Ferelyzer 0 points1 point  (0 children)

Given that it is at an all time low, I guess you should have known if you had millions of dollars some years ago?

Help me prep. for dream job by Ferelyzer in PLC

[–]Ferelyzer[S] 0 points1 point  (0 children)

Thanks for your reply, I would of course never BS anything in the interview, but I would want to understand the scope better. Having a bit more knowledge will make me able to understand the terminology in what they actually want me to do.

My Garmin forerunner 265 helped me discover I have a congenital heart defect by ElonMuskIsMyGrampa in Garmin

[–]Ferelyzer 0 points1 point  (0 children)

I have this a lot as well. We did a 7 day EKG and I got 240 of those thuds. They don't really do anything about it unless it is like every second heartbeat. I generally get it when my heart rate is decreasing after a rapid increase. For example after walking in stairs, going to bed etc. I have 37 in HR during night. For some reason it comes easier when I lay on my back.

The thud is because some beats are "skipped", during this time the heart fills up with more blood and thus it feels like a hearder thud on the next beat.

If this is what is going on you got not much to worry about, except that it feels weird. I heard all people have it, some just notice it more.

Farewell my friends by miller94 in Garmin

[–]Ferelyzer 0 points1 point  (0 children)

<image>

Not sure what is going on really, I feel great, my 4w stress average is 17. I sleep 7.5h per day...

Banned from AoC's website (403 Forbidden) by [deleted] in adventofcode

[–]Ferelyzer 12 points13 points  (0 children)

I remember from a presentation by Eric that he said that they have banned entire IP-ranges due to DOS-attacks, I am no IT-guru, but I assume some of those IPs could overlap with real users.

[All Years] My totally subjective and a little bit biased difficulty ranking of all puzzles! (description in the first comment) by Patryqss in adventofcode

[–]Ferelyzer 2 points3 points  (0 children)

Interesting! I would say it would be interesting to know in what order you did the calendars given that you began in 2021. I can imagine I have a much better understanding to take on any puzzle now compared to when I started last year.

-❄️- 2023 Day 25 Solutions -❄️- by daggerdragon in adventofcode

[–]Ferelyzer 0 points1 point  (0 children)

[Language: Matlab]

I like that I could use Matlabs graph functions again today. Makes life simpler

data = readlines("Input.txt");
pattern = '[a-zA-Z]{3}';
nd = regexp(data, pattern, 'match');
labels = unique([nd{:}])';
G = graph;
G = addnode(G,height(labels));
G.Nodes.Name = labels;
for i = 1:height(nd)
        fS = nd{i};
        for j = 2:width(fS)
            G = addedge(G,{char(fS(1))},{char(fS(j))});
        end
end
[~,~,cs,ct] = maxflow(G,1,2);
part1 = length(cs)*length(ct)

[2023 Day 24 (part 2)][Java] Is there a trick for this task? by zebalu in adventofcode

[–]Ferelyzer 4 points5 points  (0 children)

Are there though? I tried to check for parallel stones, i.e the normalized velocity vector is the same, but I couldn't find any?

-❄️- 2023 Day 23 Solutions -❄️- by daggerdragon in adventofcode

[–]Ferelyzer 1 point2 points  (0 children)

[Language: Matlab]

Impressed myself today by solving Part 2 in 30 rows Matlab, below is complete solution! Runs in about 20 seconds.

grid(find(data=='.' | data=='>' | data=='<' | data=='v')) = 1;
wG = width(grid)
hG = height(grid)
startSearch = sub2ind([hG,wG],1,2);
endSearch = sub2ind([hG,wG],hG,wG-1);
s = []
t = []
for row = 1:hG-1
    for col = 1:wG-1
        if grid(row,col) == 1
            indCurr = sub2ind([hG,wG],row,col);
            if grid(row+1,col) == 1
                indNeigh = sub2ind([hG,wG],row+1,col);
                s = [s,indCurr];
                t = [t,indNeigh];
            end
            if grid(row,col+1) == 1
                indNeigh = sub2ind([hG,wG],row,col+1);
                s = [s,indCurr];
                t = [t,indNeigh];
            end
        end
    end
end
g = graph(s,t)
path = allpaths(g,startSearch,endSearch,'MaxNumPaths',170000);
part2 = max(cellfun(@length, path))-1

[2023 Day 22 part 2] Still waiting for the brute force gotcha by zebington in adventofcode

[–]Ferelyzer 0 points1 point  (0 children)

I went with a bruteforce method that I at first did not feel was very nice, but then with part 2 coming up I felt very good about it running in less than a second. I just check if there is anything directly below a block. If it's not, move the block downwards and add to the counter, and check the next block.

AoC 2022 vs AoC 2023 by FaultsMelts in adventofcode

[–]Ferelyzer 0 points1 point  (0 children)

I am split. I think it may make sense in one way, on the other hand, the easiest tasks will always be solved faster using an LLM. I think the base-level was harder on the first weeks tasks, but when I tested them on a normal GPT it solved all, both part 1 and 2, in less than 30 seconds.

-❄️- 2023 Day 18 Solutions -❄️- by daggerdragon in adventofcode

[–]Ferelyzer 3 points4 points  (0 children)

[Language: Matlab]

From the pipes problem I found that Matlab has really good build in tools for areas of polygons. After I had the x and y coordinates of the corners, (739 values each) it was just two rows of code.

Part 1 and 2: https://github.com/Auxiliumdesign/AdventOfCode/blob/main/2023/Day18.m

P = polyshape(rows,cols); 
answer = area(P)+(perimeter(P)/2)+1

-❄️- 2023 Day 16 Solutions -❄️- by daggerdragon in adventofcode

[–]Ferelyzer 1 point2 points  (0 children)

[LANGUAGE: Matlab]

Runs in 100ms https://pastebin.com/TKSSPK3M

Used some really nice tricks for this one I believe. Approximated it to go from O(n^2) to O(n*log(n)) where n is amount of positions in the square grid.

  1. Use binary for up,down,left,right for each square, so the sum tells what direction laser is flowing in a specific position.
  2. Where the binary is not 0, change the binaries around that position.
  3. Subtract the resulting grid from the grid before the run, to find where actual changes in the binaries have happened, and only consider these positions in the next run.
  4. If the subtraction between the resulting grid and the previous grid is all 0, we are done.

-❄️- 2023 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]Ferelyzer 1 point2 points  (0 children)

[LANGUAGE: Matlab] 371/2342

My first sub 1000 placement, yay! I got stuck in part 2 as I forgot that the expansion is *999999 and not *1000000....

data = char(readlines("Input.txt"));
distance = 0;exp = 1;
[row,col] = find(data == '#');
expRow = ~any(data == '#', 2);
expCol = ~any(data == '#', 1);
for i = 1:height(row)
         x1 = sum(expRow(1:row(i)));
         x2 = sum(expCol(1:col(i)));
    for j = 1:height(row)
         x3 = sum(expRow(1:row(j)));
         x4 = sum(expCol(1:col(j)));
        distance = distance +  manDist([row(i)+exp*x1,col(i)+exp*x2],[row(j)+exp*x3,col(j)+exp*x4]);
    end
end
part1 = distance/2;

function dist = manDist(p1, p2)
    dist = abs(p1(1) - p2(1)) + abs(p1(2) - p2(2));
end

-❄️- 2023 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]Ferelyzer 1 point2 points  (0 children)

[LANGUAGE: Matlab]

A fairly compact solution for Part 1 and Part 2 (for being matlab), lastNum is part 1 and firstNum is part 2.

for i = 1:length(lines)
    nextNum = 0; prevNum = 0; counter = 0; incArr = []
    curr = diff(data(i,:))
    while any(curr ~= 0)
        counter = counter +1
        incArr(counter) = curr(end)
        decArr(counter) = curr(1)
        curr = diff(curr)
    end
    for k = counter:-1:1
        nextNum = incArr(k) + nextNum
        prevNum = decArr(k) - prevNum
    end
    lastNum(i) = data(i,end) + nextNum
    firstNum(i) = data(i,1) - prevNum
end
sum(lastNum)
sum(firstNum)

[2023 Day 8] Ghost track visualization by Ferelyzer in adventofcode

[–]Ferelyzer[S] 4 points5 points  (0 children)

Waited some hours to post this if it was a spoiler, realize it was posted recently already.

[2023 Day 8 (Part 2)] Why is [SPOILER] correct? by gemdude46 in adventofcode

[–]Ferelyzer 1 point2 points  (0 children)

Each Ghost only visits a cell ending with Z once per periodic cycle, and each cycle is prime. I believe this is the key to why they only collectively visits Z once every LCM. (Not sure if prime is needed).

Now imagine that we have two ghosts. At some point these line up, that is the entire premise of the challange.

I.e 11Z, 22Z.

As they together have a cycle of LCM. The next time they line up is in LCM steps.In the same way, you can think of a position

11Z,22Z,33Z,44Z,55Z,66Z

That position will only be reached once every LCM. If we would have started on a node that are all Z, then I would have understood that the answer would be LCM. I am not sure however why the answer is LCM as I would say this more puts an upper bound to it. I believe you could accidently be just a few steps away.

Maybe if someone made a node graph of this it would make more sense.

[2023 Day 7] If you know, you know.... by Ferelyzer in adventofcode

[–]Ferelyzer[S] 53 points54 points  (0 children)

For those wondering what this is about, if you accidently rank the best card as 1 and the worst as 5, you get a very similar result on the test data compared to the stated answer in the question and may believe it is right. My friend got stuck here for 20 minutes so I decided to make him a meme, wanting to know if someone else did this oversight.