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.
Example: nums = [5,2,4,1,3] → [1,2,3,4,5].
Insertion sort is O(n²) worst case but O(n) on already-sorted input — the best-case behaviour makes it a great closer for nearly-sorted data.
[1,2,3,4,5]