Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Two strings s1 and s2 of equal length n are given. You can swap s1[i] and s2[j] if i is equal to j. The objective is to obtain minimum number of unique characters in the strings. You need to print max(unique_chars_in_s1,unique_chars_in_s2) and this should be as minimum as possible. you can perform any number of swaps and the string consists of lower-case alphabets only.

How can this be done efficiently.
Posted

1 solution

You know, we aren't supposed to do your own homework. Instead start doing it and whenever you're stuck, post specific questions here.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900