Dsa
Math
Easy
Digit Frequency
Your task is to find the frequency of each digit (0-9) in a given non-negative integer 'n'. You should return a dictionary where the keys are the digits and the values are the counts of those digits.
Input Format:
- A single line containing the integer 'n'.
Output Format:
- A dictionary with digits as keys and their frequencies as values.
Example:
Input:
1223334444
Output:
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0}
Key concepts
numberfrequencydigit
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now