Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
1liner solution in Speedy category for Not in Order by U.V
def not_order(data: list[int]) -> int:
return sum([i !=j for i,j in zip(data,sorted(data))])
print("Example:")
print(not_order([1, 1, 4, 2, 1, 3]))
assert not_order([1, 1, 4, 2, 1, 3]) == 3
assert not_order([]) == 0
assert not_order([1, 1, 1, 1, 1]) == 0
assert not_order([1, 2, 3, 4, 5]) == 0
print("The mission is done! Click 'Check Solution' to earn rewards!")
Nov. 12, 2022
Comments: