presentation
presentation

Compare the Triplets

October 31, 2019 • ☕️ 1 min read
algorithm/hackerrank

출처

// Complete the compareTriplets function below.
function compareTriplets(a, b) {
    const points = [0, 0];

    for (let i = 0; i < 3; i++) {
        if (a[i] > b[i]) {
            points[0]++;
        } else if (a[i] < b[i]) {
            points[1]++;
        }
    }
    return points;
}