Untitled

 avatar
unknown
plain_text
a month ago
641 B
3
Indexable
You are located inside an unknown polygon that may have infinitely many sides. Your goal is to “fill” or “color” the entire interior region of this polygon.

Available APIs
GET /boundary(x,y)
Returns true if (x,y) is on the boundary.
Returns false otherwise (either inside or outside the polygon).
POST /color(x,y)
Colors the point (x,y).
We assume this is the only way to color the region.

Objective
Devise an algorithm or approach that uses these two APIs to ensure the entire polygon interior gets colored, despite having no prior knowledge of the shape of the polygon (other than that it is closed and that you start inside it).
Leave a Comment