Sort the integer array nums in ascending order using insertion sort and return the result. Walk left-to-right; for each new element, slide it leftward past any larger neighbors into its correct slot.
Insertion sort is O(n²) worst case but O(n) on already-sorted input, so it suits data that is nearly sorted.
1 ≤ nums.length ≤ 1000-10⁴ ≤ nums[i] ≤ 10⁴Treat nums[0..i-1] as the sorted prefix; insert nums[i] into it by shifting larger elements right.