Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Create a frequency array of the letters of each string.
There are 26*26 possible pairs of letters to swap. Can we try them all?
Iterate over all possible pairs of letters and check if swapping them will yield two strings that have the same number of distinct characters. Use the frequency array for the check.