Sort by

recency

|

1663 Discussions

|

  • + 0 comments

    Here is my Python solution using list comprehensions! The first list is all the digits that are not 0, and the second list is all the numbers in that list that evenly divide the number. We then return the length of that list, which is the amount of numbers that work.

    def findDigits(n):
        digits = [int(digit) for digit in str(n) if int(digit) != 0]
        return len([digit for digit in digits if n % int(digit) == 0])
    
  • + 0 comments

    C#

        public static int findDigits(int n)
        {
            string nstr = n.ToString();
            int returnNum = 0;
            
            foreach (char c in nstr){
                int cur = c - '0';
                
                if (cur == 0){
                    continue;
                }
                
                if (n % cur == 0){
                    returnNum++;
                }
                
            }
            
            return returnNum;
        }
    
  • + 0 comments

    Finding the right digits can sometimes be tricky, but it’s always a rewarding challenge. By the way, if you're interested in boosting your workplace's safety standards, check out ISO 45001 Occupational Health and Safety Management System – Training Courses. It’s a fantastic way to ensure a safer, healthier environment for everyone involved!

  • + 0 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

  • + 0 comments

    java15:

    import java.util.*;

    public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int number; String napis; int divDigit=0;

        for(int i =0;i<n;i++){
            number = scanner.nextInt();
            napis = String.valueOf(number);
            String[] arrayString= napis.split("");
            int[] array = new int[napis.length()];
    
            for(int j=0;j<napis.length();j++){
            array[j]=Integer.parseInt(arrayString[j]);
            if(array[j]!=0&&number%array[j]==0) divDigit++;
            }
            System.out.println(divDigit);
            divDigit=0;
        }
    
    
    
    }