We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
My python answer:
def findDigits(n):
# Write your code here
num_string = str(n)
div = 0
for i in range(len(num_string)):
if int(num_string[i]) == 0:
continue
elif n % int(num_string[i]) == 0:
div += 1
return div
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Find Digits
You are viewing a single comment's thread. Return to all comments →
My python answer: def findDigits(n): # Write your code here num_string = str(n) div = 0 for i in range(len(num_string)): if int(num_string[i]) == 0: continue elif n % int(num_string[i]) == 0: div += 1 return div