EDIT: The link’s answer is correct, I was at fault for not checking the cases. Thanks for concern and sorry for inconvenience/confusion
Please thoroughly read the question here.
We got this question in yesterday evening’s Lab test (Make your code pass all test cases, time given-45 min).
My Query- The question (of our exam) stated that the two strings contain uppercase letters, and no more than 20 letters (so that weak algos also pass). Nowhere were we given that all characters of the string are distinct.
If I follow the solution given at that site, the code fails for cases where string has repeating characters-
Eg- ALLOOO OOOLLA
It is easily seen that we can convert string 1 to string 2 in three operation, but the code given in link prints more than 3. Similarly-
This string will always take 3 operations irrespective of length, while the code in link will print an answer which depends on length.
The Question- What is the correct solution of the above problem, if strings of repeating characters are included (if possible)?
(PS: Please help, bichaare bachche ki CG ka sawaal hai )