This problem taught you that values alone aren't enough. You need to track where values are located. A pair (value, position) keeps related data together, preventing errors from index mismatches.
I showed you how to handle overlapping movements. When two objects move in opposite directions and cross paths, you save one operation. This pattern appears in sorting, scheduling, and collision problems.
You learned to handle ties correctly. Choosing leftmost for maximum and rightmost for minimum ensures you minimize swaps. Small details in position selection can change your answer.