Chains of Close Points
Each row of points is a point. Two points are linked when they are less than reach apart, and a group is a set of points connected through links, directly or through other points. Return the number of groups.
Example 1
points [[0,0],[1,0],[2,0],[10,10]]
reach 1.5
returns 2
The first three points chain together one step at a time. The fourth is far from all of them.
Constraints
1 <= len(points) <= 60- No two points are exactly
reachapart
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More SciPy problems
- Fish in the LakeHard
- Fit the Growth CurveHard
- Implied VolatilityHard
- Most Profit PlanHard
- Safest MixHard
- Smallest Total MissHard
- Volume Over a TriangleHard
- Area Under the PointsBeginner