Example with duplicates
Input
nums = [9, 12, 3, 5, 14, 10, 10], pivot = 10
Output
[9, 3, 5, 10, 10, 14, 12]
One valid partitioning moves elements <10 to the front, equals in the middle, and >10 at the end. Order inside partitions may vary; this shows the result produced by a standard three-way partition algorithm.