Sort by

recency

|

3188 Discussions

|

  • + 0 comments

    I love the theme idea—it looks incredibly attractive and amazing! I’d like to use it for my menu-based website albaiksamenu, which is hosted on WordPress.

  • + 0 comments

    Javascript function PlusMInus(arr) { let positive = 0; let negative = 0; let zero = 0; for (let i = 0; i < arr.length; i ++) { if (arr[i] > 0) positive++; else if (arr[i] < 0) negative++; else zero++; } let total = arr.length; console.log((positive / total).toFixed(6)); console.log((negative / total).toFixed(6)); console.log((zero / total).toFixed(6));

  • + 0 comments

    Does anyone have the R solution?

  • + 0 comments

    for java 8+

    List<Integer> arrp=arrz,arrn=arrz;
            int size=arrz.size();
            double n=arrn.stream().filter((i)->i<0).count(),
            z=arrz.stream().filter((i)->i==0).count(),
            p=arrp.stream().filter((i)->i>0).count();
            DecimalFormat df = new DecimalFormat("0.000000");
            System.out.println(df.format(p/size));
            System.out.println(df.format(n/size));
            System.out.println(df.format(z/size));``
    
  • + 0 comments

    JavaScript solution

    function plusMinus(arr) {
      const long = arr.length
      
      let totalPositives = 0
      let totalNegatives = 0
      let totalZero = 0
    
      arr.forEach(e => {
        if (e > 0) totalPositives++
        if (e < 0) totalNegatives++
        if (e === 0) totalZero++
      })
    
      const calculateRatio = (total, n) => console.log((total / n).toFixed(6))
    
      calculateRatio(totalPositives, long)
      calculateRatio(totalNegatives, long)
      calculateRatio(totalZero, long)
    }