Compare the Triplets

  • + 0 comments

    Hi this is my JS solution

    function compareTriplets(a, b) {
    
    if (a.length <=0 || b.length <=0) return 0;
    
    let alice=[0,0]; 
    
    for(let i = 0; i<a.length; i++){
        if(a[i] > b[i]) {
            alice[0]++;
        } else if(b[i]>a[i]){
            alice[1]++;
        }
    }
    return alice;
    
    }