Back to problems

Streaming Points: Emit K Within Distance

Algorithm · Google · Medium

Requirements The input is provided to process(points: Iterable[float], d: float) -> Iterable[tuple[float, float, float]] as an uninterrupted sequence of floating-point coordinates, and d is the nonnegative distance threshold. Keep every point that has arrived but has not yet been emitted. As soon as a valid set of three points can be formed in which every pair is no farther apart than d, emit that set and delete its members from the active collection. Emit each set as a…

Checking your access…