Given a string S consisting of lowercase latin letters, arrange all its letters in lexographical order using Counting Sort.
The first line of the input contains T denoting number of testcases.Then T test cases follow. Each testcase contains positive integer N denoting the length of string.The last line of input contains the string S.
For each testcase, in a new line, output the sorted string.
This is a function problem. You only need to complete the function countSort() that takes char array as parameter and return the sorted char array. The printing is done by driver code.
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N).
1 <= T <= 105
1 <= N <= 105
Testcase 1: In lexicographical order , string will be abdes.
Testcase 2: In lexicographical order , string will be eeeefggkkorss.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.