PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

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.

  • medium
  • Bloomberg
  • Coding & Algorithms
  • Software Engineer

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.

Equal Character Frequencies

Return whether every distinct character appears the same number of times.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ('abc',)

Expected Output: True

Explanation: Each character appears once.

Input: ('abcabc',)

Expected Output: True

Explanation: Each character appears twice.

Input: ('aab',)

Expected Output: False

Explanation: Frequencies differ.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.

Equal Frequencies After One Deletion

Return whether deleting exactly one character occurrence can make all remaining character frequencies equal.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ('aabbccc',)

Expected Output: True

Explanation: Removing one c balances the string.

Input: ('aaabbbccc',)

Expected Output: False

Explanation: Exactly one deletion cannot balance it.

Input: ('aaa',)

Expected Output: True

Explanation: Removing one a leaves aa.

Input: ('a',)

Expected Output: True

Explanation: Deleting the only character leaves an empty balanced string.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Minimize Travel Assignment Cost - Bloomberg (medium)
  • Determine Balloon Popping Time - Bloomberg (medium)
  • Solve meeting and tree problems - Bloomberg (easy)
  • Minimize travel cost with two cities - Bloomberg (easy)
  • Check connectivity between two subway stations - Bloomberg (easy)