Given a string s which contains only lower alphabetic characters, check if it is possible to remove at most one character from this string in such a way that frequency of each distinct character becomes same in the string.
s = xyyz
Explanation: Removing one 'y' will make
frequency of each letter 1.
s = xxxxyyzz
Explanation: Frequency can not be made same
same by removing just 1 character.
You dont need to read input or print anything. Complete the function sameFreq() which takes a string as input parameter and returns a boolean value denoting if same frequency is possible or not. Note: The driver code print 1 if the value returned is true, otherwise 0.
Expected Time Complexity: O(N) where N is length of str Expected Auxiliary Space: O(1)