![]() |
VOOZH | about |
Given two strings return the value of least number of manipulations needed to ensure both strings have identical characters, i.e., both string become anagram of each other.
Examples:
Input : s1 = "aab" s2 = "aba" Output : 2 Explanation : string 1 contains 2 a's and 1 b, also string 2 contains same characters Input : s1 = "abc" s2 = "cdd" Output : 2 Explanation : string 1 contains 1 a, 1 b, 1 c while string 2 contains 1 c and 2 d's so there are 2 different characters
Question Source : Yatra.com Interview Experience | Set 7
The idea is to create a extra count array for both the strings separately and then count the difference in characters.
Implementation:
2