Back to problems

Equal Frequency After One Deletion

Algorithm · Bloomberg · Medium

You are given a string s consisting entirely of lowercase English letters. Determine whether the string can be transformed into a "good" string by removing at most one character from it. A string is considered good when every distinct letter in it appears with the same frequency. For example, "aabb" is good because both 'a' and 'b' occur twice, while "abac" is not good because 'a' appears twice, but 'b' and 'c' each appear only once. Return true if s is already good or can…

Checking your access…