You may swap the characters at given index pairs as often as you like. Find the lexicographically smallest string you can reach.
You may swap the characters at given index pairs as often as you like. Find the lexicographically smallest string you can reach.
Opens with the full question.