Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Not in Order by Ivan_Malashenko
def not_order(data: list[int]) -> int:
data1 = sorted(data)
return sum([data[i]!= data1[i] for i in range(len(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!")
Jan. 21, 2023
Comments: