Hey gang! Im really really struggling with AOC day...
# advent-of-code
b
Hey gang! Im really really struggling with AOC day 2 part 2 (2024) and its flaring up the old imposter syndrome (hahahaha!) Anyway, just wondering if anyone has any slightly cryptic clues that might help me think abuot how to solve it without giving the answer away? just a little something to point me on the right path so i dont feel like such a nooooobbbb ❤️ Thank youuuu ❤️ K
r
You are probably only accounting for one of the two conditions. If the bad level is removed, either or both conditions may switch from a fail to a pass.
b
thank you @rocketraman for your reply matey 🙂 ooo ok ill check into that and be sure 🙂 Any more hints at all that come to mind hola at me 🙂 ❤️
r
Are you using
zipWithNext
?
b
Ooooooooooo i am nottttt!
zip
interestinggggg ok can you tell me more? this is the exact sort of thing i was hoping to get hahah 😉
r
zipWithNext
is a reasonable data structure to use for part 1, because it makes the test trivial to implement. But for part 2 its a bit tricky because removing a level changes two entries in the
zipWithNext
list.
b
oooooooooo
amazing!!! ok ill investigate from here! thank you so so much @rocketraman
👍 1
Screenshot 2024-12-02 at 14.51.44.png
d
I didn't know about
zipWithNext
so I just used
windowed(2)
that should work the same.
❤️ 1
👍 1
n
Yeah,
windowed
work similar, but
zipWithNext
supports a lambda parameter, and thus you can use
Copy code
zipWithNext { a, b -> a - b }
to get a list of deltas.
s
Hey there @Ben Kadel I am struggling with similar issue, but my code gives lower answer for the puzzle input, and the correct answer for test input. Have you solved day 2 yet? The second part
b
hey @Safi K i have indeed, but it was the hardest part so far for me! The tip i can give you that someone else (@maiatoday the wonderful) gave me was to, not be afraid to use brute force, as the data set is only 1000 entries so its not too bad to consider simply looping through everything and then looping through each character and trying the entry without that character.... if that makse sense?
you are breathtaking 1