Reconstructing Digits from English Names with Java

🚀 Day 91 of My 100 Days LeetCode Challenge | Java Today’s challenge was a clever string + frequency analysis problem. The task was to reconstruct the original digits (0–9) from a scrambled string containing the letters of their English names (like zero, one, two…). At first glance it looks messy because letters overlap across multiple numbers. The key insight was noticing that certain letters are unique to specific digits: z → zero (0) w → two (2) u → four (4) x → six (6) g → eight (8) By identifying these unique markers first, we can determine those digits and then subtract their letter counts to uncover the remaining ones. ✅ Problem Solved: Reconstruct Original Digits from English ✔️ All test cases passed (24/24) ⏱️ Runtime: 4 ms 🧠 Approach: Frequency Counting + Greedy Deduction 🧩 Key Learnings: ● Character frequency counting can simplify complex string problems. ● Unique identifiers often unlock greedy solutions. ● Solving certain elements first can reveal hidden dependencies. ● Careful ordering of deductions avoids incorrect counts. ● Many string puzzles become manageable with pattern observation. This problem was a great reminder that recognizing unique patterns can turn a confusing problem into a structured solution. 🔥 Day 91 complete — improving pattern recognition and string processing skills. #LeetCode #100DaysOfCode #Java #Strings #Algorithms #ProblemSolving #DSA #CodingJourney #Consistency

  • graphical user interface, text, application

To view or add a comment, sign in

Explore content categories