Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
One-liner solution in Clear category for Nearest Value by tom-tom
def nearest_value(values: set, one: int) -> int:
return min(values, key=lambda x: (abs(x - one), x))
April 5, 2019