Company: Atlassian
Difficulty: medium
Rearrange Students Description In a school, two lines of students, **A** and **B**, are arranged with `n` students in each line, facing each other. The Physical Education teacher wants the heights of the students standing across from each other to be equal. Two operations are available: **Reorder within a line.** Students in the same line may be rearranged among themselves any number of times. This is free — it costs nothing. **Swap across the lines.** Any student in one line may be swapped with any student in the other line. Such a swap costs the height of the **shorter** of the two students involved, that is, `min(height of the student from A, height of the student from B)`. Any number of operations may be performed, in any order, and a student may take part in more than one swap. You are given `arrA`, the heights of the students in line A, and `arrB`, the heights of the students in line B. Determine the **minimum total cost** needed to reach a configuration in which every student fa