Hackerrank | Find Digits

Explanation:

    Split the numbers with traditional method and check the remainder.



def findDigits(n):
    hold = n
    count = 0
    while hold != 0:
        rem = hold % 10
        if rem !=0 and n % rem == 0 :
            count += 1
        hold = int(hold / 10)
    
    return count

Comments

Popular posts from this blog

Hackerrank | Sequence Equation

HackerRank | Organizing Containers of Balls

HackerRank | Minimum Distances