aboutsummaryrefslogtreecommitdiff
path: root/challenge-195/eric-cheung/python/ch-1.py
blob: 4839f6f0fc997802b76c525ea8b64e1055539ca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
def IsNumSpecial(nInput):

    if nInput < 11:
        return True

    arrList = list(map(int, str(nInput)))
    arrUniqList = list(set(arrList))

    for nLoop in arrUniqList:
        if arrList.count(nLoop) > 1:
            return False

    return True

def nCountNumSpecial(nNum):

    arrOutputList = []

    for nVar in range(1, nNum + 1):
        if IsNumSpecial(nVar):
            arrOutputList.append(nVar)

    return len(arrOutputList)


## nGivenInput = 15  ## Example 1
nGivenInput = 35  ## Example 2

print (nCountNumSpecial(nGivenInput))