Summary for those just joining us:
Advent of Code is an annual Christmas themed coding challenge that runs from December 1st until christmas. Each day the coding problems get progressively harder. We have a leaderboard and pretty good turnout, so feel free to hop in at any time and show your stuff!
Whether you have a single line monstrosity or a beautiful phone book sized stack of OOP code, you can export it in a nice little image for sharing at https://carbon.vercel.app
What did you think about today's problem?
Our Code is 2416137-393b284c (No need to share your profile, you have the option to join anonymously if you don't want us to see your github)
Jump in the discussion.
No email address required.
I feel like Yandev with this terrible code, but what I did was trace along the path while marking every orthogonal unoccupied square on the grid with either an L or R depending on whether it's on my relative left or right while I travel along the loop. Then I make the Ls and Rs spread out along orthogonal squares using BFS until there's no more unoccupied squares. From there, I can tell where L or R is the enclosed area because the other one will be touching the edge of the grid, and I can just count them to get the answer.
Jump in the discussion.
No email address required.
More options
Context