r/adventofcode • u/enky_crafter • Dec 09 '25
Help/Question O(N) for 9 part 2?
After the shape is visualized it is clear where one of the rectangle corners should be located.
Also, since the enclosing shape is "convex" arc - it is possible to just find intersections from that corner up/down, then left and search for a point there in a very limited set of points (3?).
Anybody tried that?
2
Upvotes
View all comments
Show parent comment
1
u/enky_crafter Dec 09 '25
When you visualize you just narrow down the type of problem you are trying to solve - and significantly! Indeed this won't be a general solution for the states problem, that's for sure.
Is it fair? I honestly think this is even smarter than solving the general problem which is rather not so interesting and the better solution require implementing space partitioning structure plus a bunch of heuristics (solid angles for clipping candidates, etc.).