Round 2
Questions: You are organizing a classroom where n students are currently sitting in scattered seats. To make group activities easier, you want to rearrange the students so they sit in consecutive seats, minimizing the number of moves.
Input Format:
- The first line contains an integer n, the number of students.
- The next line contains unique integers, representing the current seat numbers occupied by the students.
Output Format:
- Print a single integer: the minimum number of moves required to arrange all the students in consecutive seats.
Constraints:
- 1 <= n <= 10^7
- Each seat number is a non-negative Integer within a 32-bit signed Integer range.
Example:
Input 4 1 3 8 10 Output 2
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.