taumBday

    0

    0

    The code creates a two number array, whiteGifts and blackGifts . It then calculates the difference between the values in each array, and assigns the smaller value to min . Finally, it assigns the value of min to the variable named min .

    function taumBday(b, w, bc, wc, z) {
      const gifts = BigInt(b) + BigInt(w);
    
      const whiteGifts = gifts * BigInt(wc) + (BigInt(b) * BigInt(z));
      const blackGifts = gifts * BigInt(bc) + (BigInt(w) * BigInt(z));
    
      let min = BigInt(b) * BigInt(bc) + BigInt(w) * BigInt(wc);
    
      (blackGifts < min) && (min = blackGifts);
      (whiteGifts < min) && (min = whiteGifts);
    
      return min;
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.