
[LeetCode] 2948. Make Lexicographically Smallest Array by Swapping Elements (Python)
·
알고리즘/LeetCode
난이도: Medium문제 설명You are given a 0-indexed array of positive integers nums and a positive integer limit. In one operation, you can choose any two indices i and j and swap nums[i] and nums[j] if |nums[i] - nums[j]| . Return the lexicographically smallest array that can be obtained by performing the operation any number of times. An array a is lexicographically smaller than an array b if in the fir..