Number 9, turn me on dead man! And... grids again. While the first part of today’s puzzle is easy to implement, the second part got me down the rabbit hole of the shapely library, GEOS computational geometry, DE-9IM matrices, ray-casting and all sorts of other wildly interesting theoretical mathematical knowledge.

Let’s dive in!

Check out my full solution for day 9 at GitHub.

Part one

As input, we get a couple of coordinates in a grid that represent red tiles:

7,1
11,1
11,7
9,7
9,5
2,5
2,3
7,3

Our job is to find the biggest rectangle that can be made using any combination of two of these coordinates, where the coordinates represent the opposite edges of the rectangle. For example, the rectangle with edge coordinates 2,5 and 9,7 runs from coordinate 2,5

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help