heights shows how they actually lined up: heights[i] is the height of the person at position i.
Compare the current line with the correct one (sorted in non-decreasing order) and return the number of positions where the heights differ.heights=[150, 140, 160, 160] → 2
Sorted by height, the line should be [140, 150, 160, 160]. The first two people are out of place.
heights=[3, 1, 2] → 3
The right order is [1, 2, 3], and no position matches it.
heights=[5, 5, 7] → 0
len(heights) ≤ 1000heights[i] ≤ 300heights=[150, 140, 160, 160]
2
Run checks the first 3 tests in your browser. Submit checks all 118 tests on the server, hidden ones included.