Digit Frequency Table
Given a non-negative integer n, return exactly ten integers. The value at index d is the number of occurrences of decimal digit d in n. Return the counts in…
Given a non-negative integer n, return exactly ten integers. The value at index d is the number of occurrences of decimal digit d in n. Return the counts in order from digit 0 to digit 9, including zero counts. Leading zeros are not represented. The integer 0 has one decimal digit, so its count for digit 0 is one.
0 <= n <= 1,000,000,000. n is an integer. Return an integer array of length ten.
Example 1: input n = 1210; output [1,2,1,0,0,0,0,0,0,0]. One zero, two ones and one two occur; every other digit is absent.
Example 2: input n = 0; output [1,0,0,0,0,0,0,0,0,0]. Zero is written as one digit 0.
Example 3: input n = 111; output [0,3,0,0,0,0,0,0,0,0]. Only digit 1 occurs, three times.
Category: Math & Numbers. Topic: math. Difficulty: Easy. Patterns: math.