Min Manipulations to make Strings Anagram
Easy Accuracy: 39.43% Submissions: 884 Points: 2

Given two strings in lowercase, your task is to find minimum number of manipulations required to make two strings anagram without deleting any character. If two strings contains same data set in any order then strings are called Anagrams.

Example 1:

Input:
S1 = "aba", S2 = "baa", N = 3
Output: 0
Explanation: Both the strings are already
anagrams.

​Example 2:

Input: 
S1 = "ddcf", S2 = "cedk", N = 4
Output: 2
Explanation: We can change 'e' and 'k' in
S2 to 'd' and 'f' to make both the strings
anagram. 


Your Task:
You don't need to read input or print anything. Your task is to complete the function minManipulation() which takes the strings S1 and S2 and their length N as inputs and returns the minimum number of manipulations required to make both the strings anagram.


Expected Time Complexity: O(N).
Expected Auxiliary Space: O(1).


Constraints:
1<=N<=105

|S1| = |S2| = N

|S| represents the length of the string S.

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.


to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Min Manipulations to make Strings Anagram

Output Window