posts[i] = [x, y] gives the position of post i. A rope of the smallest possible length is stretched around the plot so that every post is inside it or on the rope itself.
Return the coordinates of every post that lies exactly on the rope, at a corner of the enclosure or along one of its sides. The order of the answer does not matter.posts=[[0, 0], [4, 0], [4, 3], [0, 3], [2, 1], [2, 3]] → [[0, 0], [4, 0], [4, 3], [2, 3], [0, 3]]
The rope follows the rectangle with corners (0, 0), (4, 0), (4, 3), (0, 3). Post (2, 3) sits on the top side and touches the rope too; (2, 1) is inside.
posts=[[5, 5], [1, 1], [3, 3]] → [[5, 5], [1, 1], [3, 3]]
All posts lie on one line, so the rope passes through each of them.
posts=[[7, 2]] → [[7, 2]]
posts=[[0, 0], [4, 0], [4, 3], [0, 3], [2, 1], [2, 3]]
[[0, 0], [4, 0], [4, 3], [2, 3], [0, 3]]
Run checks the first 3 tests in your browser. Submit checks all 111 tests on the server, hidden ones included.