Make Palindrome
Practice
3.9 (10 votes)
Basics of string manipulation
String algorithms
Algorithms
Problem
55% Success 4782 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

There is a string that consists of lowercase english alphabets and we have to make the string a palindrome
For this, we have \(2\) types of operations
1. Re-arrange the string however you want (this operation is free)
2. Add a new character to the end of the string (this operation will cost 1Re)

Your task is to calculate the minimum amount of money to make the string a palindrome

Input Format:
The first line contains one integer \(T\) the number of test cases
The first line of every test case consists of \(N\), the length of the string 
The second line of every test case contains string \(S\)


Output Format:
For every test case output one integer, the minimum amount of money required to make the string a palindrome

Constraints:

\(1 \leq T \leq 100 \\ 1 \leq N \leq 10^5\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
40 votes
Tags:
AlgorithmsApprovedEasyOpen
Points:20
17 votes
Tags:
AlgorithmsBasic ProgrammingEasyString Manipulation
Points:20
642 votes
Tags:
Ad-HocEasyOpenString Manipulation