Sort by

recency

|

26 Discussions

|

  • + 0 comments

    Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Divisible Numbers Problem Solution

  • + 0 comments

    Here is Divisible Numbers problem solution in Python Java C++ and C programming - https://programs.programmingoneonone.com/2021/07/hackerrank-divisible-numbers-problem-solution.html

  • + 0 comments
    static int divisibleNumbers(int n) {
            /*
             * Write your code here.
             */
            int a;
            for (int i = n; ; i += n) {
                int sum = 0, product = 1, q = i, count = 0;
                boolean flag = true;
                while (q > 0) {
                    int rem = q % 10;
                    if (rem == 0) {
                        flag = false;
                        break;
                    }
                    sum += rem;
                    product *= rem;
                    count++;
                    q /= 10;
                }
                if (flag) {
                    if (sum >= product) {
                        a = count;
                        break;
                    }
                    else
                        continue;
                }
                continue;
            }
            return a;
        }
    

    I'm really not getting what to do about this???

  • + 0 comments

    Trying in Python. Not getting a lot of the test cases beacuse of timeouts. Any hint as to what I can do to minimize the time ? you would still need to calculate the sum and product of each iteration ?

  • + 1 comment

    whats the answer