Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6381 |

@blackshadows | 6329 |

@mb1973 | 5388 |

@Quandray | 5231 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 4510 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3522 |

@sushant_a | 3459 |

@verma_ji | 3357 |

@KshamaGupta | 3318 |

Complete Leaderboard | |

Handle | Score |

@1905439 | 553 |

@terabaap123 | 508 |

@smitadiwedi1991 | 279 |

@DevanandJayakumar | 250 |

@atishagusain | 244 |

@gupta_10 | 226 |

@nipun edara | 224 |

@shubhamkhullar7 | 224 |

@sharmachandan487 | 204 |

@balunagar | 204 |

@arshjit_singh7 | 190 |

Complete Leaderboard |

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**.

```
Input :
s1 = "aba"
s2 = "baa"
Output : 0
Explanation: Both String contains identical characters
Input :
s1 = "ddcf"
s2 = "cedk"
Output : 2
Explanation : Here, we need to change two characters
in either of the strings to make them identical. We
can change 'd' and 'f' in s1 or 'e' and 'k' in s2.
```

**Input:**

The first line of input contains an integer **T** denoting the number of test cases. Then **T** test cases follow. First line of each test case contains an integer **N**, denoting the size of the string, next line contains **two strings** to make them anagrams.

**Output:**

Output the minimum number of manipulations required to make two strings anagram. If two strings are Anagram return 0.

**Constraints:**

1<=T<=100

1<=length of string<=10^{3}

**Example:
Input:**

2

3

gfg fgg

5

abcde abcce

0

1

Login to report an issue on this page.

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

Yes
Min Manipulations to make Strings Anagram

...