Compare the Triplets

Sort by

recency

|

4333 Discussions

|

  • + 0 comments

    Javascript

    let aScore = 0, bScore = 0;

    for (let i = 0; i <= 2; i++) { if (a[i] > b[i]) { aScore++; } else if (a[i] < b[i]) { bScore++; } }

    return [aScore, bScore];

  • + 0 comments

    In an emotion-aware software system — such as a chatbot, mood tracker, or mental health app — the Emotion Wheel helps represent human emotions in a structured way.

  • + 0 comments

    In c++

    vector compareTriplets(vector a, vector b) { vector arr; int x=0,y=0; for (int i=0;i

        if(a[i]>b[i]){
            x++;
        }
        else if(a[i]<b[i]){
            y++;
        }
    

    }arr.push_back(x); arr.push_back(y); return arr;

    }

  • + 0 comments

    Javascript

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

    using System.CodeDom.Compiler; using System.Collections.Generic; using System.Collections; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.Serialization; using System.Text.RegularExpressions; using System.Text; using System;

    class Result {

    /*
     * Complete the 'compareTriplets' function below.
     *
     * The function is expected to return an INTEGER_ARRAY.
     * The function accepts following parameters:
     *  1. INTEGER_ARRAY a
     *  2. INTEGER_ARRAY b
     */
    
    public static List<int> compareTriplets(List<int> a, List<int> b)
    {
        int pointAlice = 0;
        int pointBob = 0;
        //int [] total;
        List<int> resultList = new List<int>();
        for (int i=0; i < a.Count;i++)
        {
            if (a[i]>b[i]){
                pointAlice += 1;   
            }
            if (a[i]<b[i])
            {
                pointBob += 1;
            } 
        }
        resultList.Add(pointAlice);
        resultList.Add(pointBob);
        return  resultList;
    
    }
    

    }

    class Solution { public static void Main(string[] args) { TextWriter textWriter = new StreamWriter(@System.Environment.GetEnvironmentVariable("OUTPUT_PATH"), true);

        List<int> a = Console.ReadLine().TrimEnd().Split(' ').ToList().Select(aTemp => Convert.ToInt32(aTemp)).ToList();
    
        List<int> b = Console.ReadLine().TrimEnd().Split(' ').ToList().Select(bTemp => Convert.ToInt32(bTemp)).ToList();
    
        List<int> result = Result.compareTriplets(a, b);
    
        textWriter.WriteLine(String.Join(" ", result));
    
        textWriter.Flush();
        textWriter.Close();
    }
    

    }