https://kotlinlang.org logo
#advent-of-code
Title
# advent-of-code
s

Safi K

12/09/2023, 6:12 PM
Now I am stuck in day 8 part 2. I have read in Reddit that brute forcing is not the best solution here. But I am not good at math. Can anyone give me more detailed example of LCM or any other method that will be used to get rid of brute force?
Like, a small example of the method on some sample data, not necessarily related to the test-input or input.
And in the beginning, I store nodes in a map. Does this have to be optimized as well?
d

Damir Krancpiler

12/09/2023, 6:21 PM
Hey, you can check out this website with an example already in the input. If you change your steps in the "Show steps" dropdown you can find different ways of calculating it and apply what seems to fit to you. https://www.calculatorsoup.com/calculators/math/lcm.php
2 Views