Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
math solution in Clear category for Missing Number by kdim
def missing_number(items: list[int]) -> int:
return (min(items) + max(items)) * (len(items) + 1) / 2 - sum(items)
print("Example:")
print(missing_number([1, 4, 2, 5]))
assert missing_number([1, 4, 2, 5]) == 3
assert missing_number([2, 6, 8]) == 4
print("The mission is done! Click 'Check Solution' to earn rewards!")
Sept. 24, 2022
Comments: