Compare the Triplets

  • + 1 comment

    Javascript

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