Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
The lowest distance value among the values solution in Clear category for Nearest Value by smilicic
def nearest_value(values, one):
closest_distance = min(abs(value - one) for value in values)
lower = one - closest_distance
higher = one + closest_distance
return lower if lower in values else higher
Nov. 16, 2020