Write an algorithm that arranges points into groups based on the following condition :
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 ?