Partition Around Pivot

Given an array of integers nums, let the pivot be the last element, nums[nums.length - 1]. Reorder nums so that every element strictly less than the pivot comes first, followed by every element equal to the pivot, followed by every element strictly greater than the pivot. Elements within each of the three groups keep their original relative order. Return the reordered array. An empty input returns an empty array.

Examples
Input: [1,2,3]
Output: [1,2,3]
Hints

Partition Around Pivot

Given an array of integers `nums`, let the pivot be the last element, `nums[nums.length - 1]`. Reorder `nums` so that every element strictly less than the pivot comes first, followed by every element equal to the pivot, followed by every element strictly greater than the pivot. Elements within each of the three groups keep their original relative order. Return the reordered array. An empty input returns an empty array.