← 返回 ibm 的题目列表Count Students Out of Ascending Order Positions
类型:online_judge
ibm
Given an array of student heights, students are required to stand in ascending order to take the annual class photograph. Identify the students who are not in the correct positions. Implement the function countStudents with the following parameters:
height: an integer array representing student heights.
Return: the number of students not standing in the correct positions.
Constraints
1 ≤ n ≤ 10^5
1 ≤ height[i] ≤ 10^9
Example
Input
5
1 3 5 4 2