Sort by

recency

|

38 Discussions

|

  • + 0 comments

    Is this not just the cardinality of the powerset - 1 since we exclude the empty set?

  • + 0 comments

    Find the best collection of Bridal Clutch online in Pakistan. Walkeaze offers the best quality bridal clutch for ladies online all over Pakistan. So, grab your favorite clutch online at low prices.

  • + 0 comments

    Java 8 solution:

    public static int solve(List<Integer> a) 
        {
            int even_number=0;
            int odd_number=0;
            int i;
            for(i=0;i<a.size();++i)
            {
                if(a.get(i)%2==0)
                {
                    ++even_number;
                }
                else
                {
                    ++odd_number;
                }
            }
            BigInteger even_comb = BigInteger.valueOf(2).pow(even_number).subtract(BigInteger.valueOf(1)).mod(BigInteger.valueOf(1000000007));
            BigInteger odd_comb =odd_number>0? BigInteger.valueOf(2).pow(odd_number-1).subtract(BigInteger.valueOf(1)).mod(BigInteger.valueOf(1000000007)):BigInteger.valueOf(0);
            BigInteger total_comb = even_comb.multiply(odd_comb).mod(BigInteger.valueOf(1000000007));
            BigInteger ans = even_comb.add(odd_comb).add(total_comb).mod(BigInteger.valueOf(1000000007));
            return ans.intValue();
        }
    
  • + 0 comments

    The problem description is exactly why I hate HackerRank.

  • + 0 comments

    FYI nice explanation on the used combinatorial identity: https://math.stackexchange.com/questions/1072881/is-there-a-closed-form-formula-for-sum-of-odd-combinations