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.
Example: nums = [5,2,4,1,3] → [1,2,3,4,5].
Selection sort always does O(n²) comparisons but at most n - 1 swaps — useful when writes are expensive.
[1,2,3,4,5]