You are given a nums and a positive integer limit.
In a single operation, you can swap the elements at any two indices i and j if nums[i] nums[j]limit.
Return the lexicographically smallest array that can be obtained by performing this operation any number of times.
Note: An array
ais lexicographically smaller than an arraybif in the first position whereaandbdiffer, arrayahas an element that is strictly smaller than the corresponding element inb.
Constraints:
nums.length
nums[i]
limit
You are given a nums and a positive integer limit.
In a single operation, you can swap the elements at any two indices i and j if nums[i] nums[j]limit.
Return the lexicographically smallest array that can be obtained by performing this operation any number of times.
Note: An array
ais lexicographically smaller than an arraybif in the first position whereaandbdiffer, arrayahas an element that is strictly smaller than the corresponding element inb.
Constraints:
nums.length
nums[i]
limit