Sort the integer array nums in ascending order using selection sort and return the result. For each position i, find the minimum element in nums[i..] and swap it into place.
Selection sort always does O(n²) comparisons but at most n - 1 swaps — useful when writes are expensive.
1 ≤ nums.length ≤ 1000-10⁴ ≤ nums[i] ≤ 10⁴Outer loop i = 0 .. n - 1: track the index of the minimum in nums[i..].