Skip to content

Advent of Code 2025 Day 9 - Satisfying solution using coordinate compression #144

@vismit2000

Description

@vismit2000

Thanks @norvig for really good concise solutions and beautiful visualizations again this year. I came back to this notebook everyday and also liked the AI notebook and LLM's way of thinking. Although it was not surprising, but the fact that LLM one-shotted even tough problems shows how far we have come along in reasoning capabilities.

Quoting from your Day 9 solution:
"My solution is unsatisfying in that it works for my input, and I strongly suspect that it would work for your input, because Eric Wastl probably created them all to be similar. But it does not work on every possible input (particularly a highly non-convex shape)."

I found 2 better ways that work for all inputs:

(1) Using python library shapely for polygons, but again unsatisfying: https://www.reddit.com/r/adventofcode/comments/1phywvn/comment/nt2gf1n/
(2) A beautiful solution using coordinate compression and prefix sum array (credits @hyperneutrino): https://github.com/hyperneutrino/advent-of-code/blob/main/2025/day-09/part-2.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions