Solved LeetCode Find the Least Frequent Digit in 100 Days of Code

🚀 Day 44 of my #100DaysOfCode Journey Today, I solved the LeetCode problem: Find the Least Frequent Digit Problem Insight: Find the digit (0–9) that appears the least number of times in a given number. Approach: • Used a frequency array of size 10 to store digit counts • Extracted digits using modulo and division • Traversed the frequency array to find the minimum occurring digit • Returned the smallest digit in case of tie Time Complexity: • O(n) Space Complexity: • O(1) (fixed size array of 10) Key Learnings: • Arrays are more efficient than HashMap when range is limited • Digit extraction using % 10 is very useful in number problems • Keeping track of minimum efficiently avoids extra passes Takeaway: Simple logic + right data structure = clean and optimal solution #DSA #Java #LeetCode #100DaysOfCode #CodingJourney #ProblemSolving

  • graphical user interface, application

To view or add a comment, sign in

Explore content categories