Task Description
- Write a function named isSelfDescribing that will check whether a given positive integer is self-describing (returns true) or not (returns false)
There are several so-called "self-describing" or "self-descriptive" integers.
An integer is said to be "self-describing" if it has the property that, when digit positions are labeled 0 to N-1, the digit in each position is equal to the number of times that that digit appears in the number.
For example, 2020 is a four-digit self describing number:
- Position 0 has value 2 and there are two 0s in the number
- Position 1 has value 0 and there are no 1s in the number
- Position 2 has value 2 and there are two 2s
- Position 3 has value 0 and there are zero 3s
Self-describing numbers < 100.000.000 are: 1210, 2020, 21200, 3211000, 42101000.
Source: Self-describing numbers - Rosetta Code