Technical Interview Question #9

Technical Interview Series

The distance between two points is …

image 
Create a function which does the following…

Record the last 150 points (x, y) provided to the function (bonus points for allowing a configurable number of points).

Determine which of the previous points are less than a configured distance between the new point and the previous points.

There may be hundreds of new points in a second… Consider the impact of time and CPU impact for your solution.

(if your preferred programming language does not have a square root function, assume one exists.)