There are some trees, where each tree is represented by (x,y) coordinate in a two-dimensional garden. Your job is to fence the entire garden using the
minimum length of rope as it is expensive. The garden is well fenced only if all the trees are enclosed. Your task is to help find the coordinates of trees which are exactly located on the fence perimeter. Example 1:
Even you only have trees in a line, you need to use rope to enclose them.
All trees should be enclosed together. You cannot cut the rope to enclose trees that will separate them in more than one group.
All input integers will range from 0 to 100.
The garden has at least one tree.
All coordinates are distinct.
Input points have
NO order. No order required for output.
Seen this question in a real interview before?
When did you encounter this question?
last 3 month
last 6 month
more than 6 months
On Campus Interview