Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
1line solution in Clear category for Nearest Value by wooilkim
def nearest_value(values: set, one: int) -> int:
return sorted(list(values), key=lambda x: (abs(x - one), x))[0]
May 25, 2021