Given a string s of lowercase alphabets and a number k, the task is to print the minimum value of the string after removal of ‘k’ characters. The value of a string is defined as the sum of squares of the count of each distinct character.
Input: s = abccc, k = 1
We remove c to get the value as 12 + 12 + 22
Input: s = aabcbcbcabcc, k = 3
Explaination: We remove two 'c' and one 'b'.
Now we get the value as 32 + 32 + 32.
You do not need to read input or print anything. Your task is to complete the function minValue() which takes s and k as input parameters and returns the minimum possible required value.
Expected Time Complexity: O(N*logN) where N is the length of string Expected Auxiliary Space: O(N)