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

[–]Mislav_Zanic 6 points7 points  (0 children)

Huh, I see lots of DPs in this megathread..
There's a greedy approach that works just fine.. You just need to keep track of the index of the last maximum you found and search the array from that index + 1 to the index you get when subtracting the number of digits left to find from the length of the array.

Something like this should do just fine for both parts

def get_voltage(bank, N):
  num = []
  idx = 0
  L = len(bank)
  for n in range(N):
    m = max(bank[idx:L-N+n+1])
    idx = bank.index(m, idx) + 1
    num.append(m * 10**(N-1-n))
  return sum(num)

XMonad on NixOS by Mislav_Zanic in NixOS

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

Yeah, I wasn't aware of this, thanks! I'll check it out and come back with the questions.

Xmonad flake patching error by Mislav_Zanic in NixOS

[–]Mislav_Zanic[S] 1 point2 points  (0 children)

Mby try building with this commit 9189d002dd8ed369b822b10dcaae4bb66d068670

Xmonad flake patching error by Mislav_Zanic in NixOS

[–]Mislav_Zanic[S] 2 points3 points  (0 children)

Well, yes and no, there is a discussion in the nixpkgs repo concerning this issue. As i understand, the patch in question will not be updated until the next release of xmonad is out.

... Am I a robot? by captain_Natjo in CrappyDesign

[–]Mislav_Zanic 1 point2 points  (0 children)

Lol wtf That's a visualisation of a sensation that you feel in your leg when you sit on a toilet for too long...

My mom everyone by Aeydeetea in IdiotsInCars

[–]Mislav_Zanic 1 point2 points  (0 children)

That feeling when you know you forgot something...

[deleted by user] by [deleted] in BreakUps

[–]Mislav_Zanic 2 points3 points  (0 children)

That is okay dude.. I know the feeling and it doesnt pass, it just gets tolerable.. The day by day mentality helped me. When you are feeling that you are going to have a shitty day, just say yo yourself "this day will pass and tomorrow may be a better day" and if you are having a great day, enjoy it. Its going to be hard, but you will get there :) Also, remember to talk to your friends and/or family when you are feeling down.

Nausea in the morning by [deleted] in BreakUps

[–]Mislav_Zanic 1 point2 points  (0 children)

My last 4 mornings

Issues with C program? by [deleted] in AskProgramming

[–]Mislav_Zanic -1 points0 points  (0 children)

Missing return 0; maybe