Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
sorted abs(one - i) solution in Clear category for Nearest Value by Olpag
def nearest_value(values: set, one: int) -> int:
return sorted(values, key=lambda i: (abs(one - i), i))[0]
April 9, 2019