Students stand in a line for a photo and should be arranged in non-decreasing order of height. `expected[i]` is the height the i-th student would have in that sorted line. Given the current line `heights`, return the number of indices where `heights[i] != expected[i]`.
Students stand in a line for a photo and should be arranged in non-decreasing order of height. expected[i] is the height the i-th student would have in that sorted line. Given the current line heights, return the number of indices where heights[i] != expected[i].
Example 1:
Input: {"heights":[1,1,4,2,1,3]}
Output: 3
Constraints:
1≤heights.length≤100
1≤heights[i]≤100
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"heights":[1,1,4,2,1,3]}
6 students stand in line. Count how many are not where a sorted line would put them.