Answers for "triplets hackerrank solution"

0

Compare the Triplets

//leveraging True and False into increments
for a, b in zip(alice, bob):
    score[0] += a > b
    score[1] += a < b
Posted by: Guest on November-07-2020
0

beautiful triplets hackerrank solution in python

def beautifulTriplets(d, arr):
    a = set(arr)
    return len([1 for i in arr if i+d in a and i+d*2 in a])
n,d = map(int,input().split())
arr = list(map(int,input().split()))
print(beautifulTriplets(d, arr))
Posted by: Guest on April-09-2021
0

hackerrank compare the triplets

func compareTriplets(a []int32, b []int32) []int32 {
    var arr []int32
    var alice, bob int32

    for i, _ := range a {
        if a[i] > b[i] {
            alice++
        } else if a[i] < b[i] {
            bob++
        }
    }

    data := append(arr, alice, bob)
    return data
}
Posted by: Guest on October-28-2021

Code answers related to "triplets hackerrank solution"

Code answers related to "Javascript"

Browse Popular Code Answers by Language