You are viewing a single comment's thread. Return to all 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; }
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Compare the Triplets
You are viewing a single comment's thread. Return to all comments →
Hi this is my JS solution