Make Lexicographically Smallest Array by Swapping Elements at Atlassian

Medium60.2% acceptance

This problem has 62.5% frequency at Atlassian.

Problem Description

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]| <= limit`. Return _the**lexicographically smallest array** that can be o...

Read full problem and hints

Topics

Also asked at 4 companies


More Atlassian Questions

View all Atlassian questions