Question bank › Math
Dsa Math Medium

Digit Count in Number

Write a program that counts how many times each digit (0-9) appears in an integer number, including negative integers. Ignore any leading sign and print the counts for each digit from 0 to 9 in a single line, space-separated. Input format: A single integer, which can be negative. Output format: Print ten integers representing the counts of digits from 0 to 9, in order. Example: Input: -123321 Output: 2 0 0 0 0 0 0 0 0 0

Key concepts

countingdigitsmath

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.