FunctionRacerProblemsRace

Chains of Close Points

HardSciPyPython

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More SciPy problems