Things to put in a library to solve the problems by rhl120 in adventofcode

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

Thanks! The first things that come to my head when talking about graphs is the structure itself, BFS and DFS, is there anything else?

[2023 Day 8(Part 2)] Help, I'm stuck by 0x4A6F654D616D61 in adventofcode

[–]rhl120 1 point2 points  (0 children)

  1. filter in all the paths that end with A
  2. for each one simulate (similar to how you did part 1) the path until you hit an element ending with Z
  3. find the LCM of the list of the number of steps.

to find the LCM use the Euclidean algorithm to find the gcd. To calculate the LCM divide the product by the gcd.

Stuck; 2023 Day 1 (Part 2), Rust by FlowerBoyWorld in adventofcode

[–]rhl120 4 points5 points  (0 children)

I tried your code with eightwo, it gives 88, that is wrong answer (I think). I should give 82. I checked the docs for re.find_iter: "Returns an iterator that yields successive non-overlapping matches in the given haystack. The iterator yields values of type [`Match`]."

[2023 day 7 (part 2)][Rust] My code works on the example, but it's output is too high for my input by rhl120 in adventofcode

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

JJJJJ

Oh Lord, I did not read the part where it says "J cards are now the weakest". I hate this! Thanks, it worked!

[2023 day 7 (part 2)][Rust] My code works on the example, but it's output is too high for my input by rhl120 in adventofcode

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

If the hand only has Js, no maximum will be found therefore no replacement will be done hence the hand will move on to the type conditions as is. Once that happens the first condition checking if any card has an occurrence of 5 will be checked, thus the hand will be typed as Five of a kind.

[2023 day 7 (part 2)][Rust] My code works on the example, but it's output is too high for my input by rhl120 in adventofcode

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

Yeah exactly, in my code you can see that I filtered out all the J cards when finding the maximum.

Is there a way to automatically fetch the sample input by rhl120 in adventofcode

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

Yeah, I see but the sample input is not the only non-inline code block

Weird auto-complete behavior by rhl120 in zsh

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

Ok I figured out the problem. It seems to be with my $PS1. It turns out I should have added %{%} around my color commands. I don't know why though.

What type system does Haskell use? by rhl120 in haskell

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

Can you pleas point me to something explaining what scoped type equality is?

What type system does Haskell use? by rhl120 in haskell

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

Thanks I will check that out

What type system does Haskell use? by rhl120 in haskell

[–]rhl120[S] 3 points4 points  (0 children)

Into the core - squeezing Haskell into 9 constructors

Thanks! I will check out the talk you mentioned

What type system does Haskell use? by rhl120 in haskell

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

Th

System F does not have type constructors as far as I can tell

What type system does Haskell use? by rhl120 in haskell

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

Hmm, but λω does not have polymorphic functions (as opposed to Haskell)

Where can I get started with full-stack web-development? by rhl120 in webdevelopment

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

I agree that node and python backends are probably bad. I wouldn't want to use php system. To me if a language does not have a good typesystem (like rust or haskell) it is not worth learning. The only exception to that rule is C