Free written solution

Lexicographically Smallest Equivalent String (LeetCode 1061): Solution and Explanation

Pairs of letters are declared equivalent. Rewrite a base string using the smallest equivalent letter at every position.

Read the intuition, approach, code and complexity →