Sort by

recency

|

471 Discussions

|

  • + 0 comments

    Using Java

    class MyCalculator implements AdvancedArithmetic{

    @Override
    

    public int divisor_sum(int n) { int sum=0; for(int i=1;i<=n;i++) { if(n%i==0) sum += i;

        }
        return sum;
    }
    

    }

  • + 0 comments

    You can optimize by going only up to sqrt(n) and adding both the factors at once (similar principal when looking for Prime numbers).

        public int divisor_sum(int n) {
            if(n==1) return 1;
            int sum=0;
            for(int i=1; i * i <= n; i++) {
                if(n%i==0) {
                    sum += i;
                    sum += n/i; //other factor of a * b = n
                }
            }
            return sum;
        }
    
  • + 0 comments

    This website is shit bro.

  • + 0 comments

    Here is java Interface solution - https://programmingoneonone.com/hackerrank-java-interface-problem-solution.html

  • + 0 comments

    Rummy is a game of strategy, where players must plan and execute their moves carefully to outsmart their opponents. Players need to think ahead, decide which cards to keep and which to discard, and form sets and sequences while also predicting the moves of others. This process of strategic planning strengthens decision-making abilities click here to get the latest version of the app, as players are constantly assessing the potential outcomes of their actions. Such strategic thinking can be transferred to real-life situations, helping players make more informed and thoughtful decisions in daily activities.