Online Assessment Licious
Anonymous User
1143

Write an algorithm that arranges points into groups based on the following condition :

  • The distance between successive points is less than or equal to the radius where distance is the Euclidean distance between the points that are considered.
  • Each clusters grow when it aquires a new point.

Note: The clusters stop growing when it stops aquiring new points.

Once grouping of points completes then return the number of groups created.

Example 1 :

10
3:3,20:20,21:25,1:1,2:2,12:1

Output :
2

Example 2 :
4
1:1,2:2,3:3

Output :
2

I was not able to solve this question. Any thoughts how to approach it ?

Comments (4)