Solved "Equal Character Frequency" problem in #100DaysOfCode

🌟 Day 25 of #100DaysOfCode 🌟 🔍 Equal Character Frequency — Checking if All Characters Occur Equally 🔹 What I Solved Today, I solved the “Check if All Characters Have Equal Occurrences” problem — a simple yet insightful exercise in string manipulation and frequency analysis. 📝 Problem Statement Given a string s, return true if all characters that appear in s have the same number of occurrences. Otherwise, return false. ✅ Example 1: Input: s = "abacbc" Output: true Explanation: All characters ('a', 'b', 'c') occur twice. ✅ Example 2: Input: s = "aaabb" Output: false Explanation: 'a' appears 3 times, 'b' appears 2 times. Constraints: 1 ≤ s.length ≤ 1000 s consists of lowercase English letters. 🧠 Concepts Used Frequency Counting Array Manipulation Conditional Checking ⚙️ Approach Create an integer array of size 26 to store character counts. Count the frequency of each character. Identify the first non-zero frequency. Verify that all other non-zero frequencies match this one. Return true if all are equal, otherwise false. 🚀 What I Learned This problem reminded me that even simple problems can sharpen logical reasoning. Understanding how to work with frequency maps and character arrays is crucial for tackling many string-related challenges efficiently. Feeling great to be back in rhythm and pushing forward in my #100DaysOfCode journey! #100DaysOfCode #ProblemSolving #Java #DataStructures #Algorithms #CodingJourney

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories