freq
of size 10 to store the count of each digit (0-9).c
in the string num
:
c
to its integer value digit
.freq[digit]
by 1.i
in the string num
:
num[i]
to its integer value expectedCount
.freq[i]
does not equal expectedCount
, return false
.true
.