Given an array of integers nums, sort the array in ascending order using the Quick Sort algorithm — pick a pivot element, partition the array so that all elements smaller than the pivot land to its left and all elements greater land to its right, then recursively sort each side.
nums = [8,4,3,7,6][3,4,6,7,8]After a partition step completes, the pivot is guaranteed to sit in its final sorted position — every element to its left is ≤ the pivot and every element to its right is ≥ the pivot. That means recursion never needs to revisit that index again; each recursive call only has to solve the strictly smaller left and right subranges, until ranges shrink to 0 or 1 elements (already sorted by definition).