Check equal character frequencies
Company: Bloomberg
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Given a string `s`, implement two functions:
1. **Check whether all characters have equal frequency**
Return `true` if every distinct character in `s` appears the same number of times; otherwise return `false`.
Examples:
- `"abc"` -> `true`
- `"abcabc"` -> `true`
- `"aab"` -> `false`
2. **Check whether deleting exactly one character can make frequencies equal**
You must delete exactly **one character occurrence** from `s`, then determine whether every remaining distinct character appears the same number of times.
Important: if the original string is already balanced, you still must delete one character. If no single deletion results in equal frequencies, return `false`.
Examples:
- `"aabbccc"` -> `true` because removing one `c` gives `"aabbcc"`
- `"aaabbbccc"` -> `false`
- `"aaa"` -> `true` because removing one `a` gives `"aa"`
Aim for the best possible time and space complexity.
Quick Answer: This question evaluates a candidate's understanding of character frequency analysis and algorithmic reasoning in string manipulation, measuring the ability to recognize frequency invariants and handle edge cases.