We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/* In C */#include<stdio.h>voidcompareTriplets(inta_count,inta[],intb_count,intb[],intresult_count[]){for(inti=0;i<3;i++){if(a[i]>b[i]){a_count++;}elseif(b[i]>a[i]){b_count++;}}for(inti=0;i<2;i++){result_count[i]=(i==0)?a_count:b_count;}printf("%d ",result_count[0]);printf("%d",result_count[1]);}voidfillVectors(inta[],intb[]){for(inti=0;i<3;i++){scanf("%d",&a[i]);}for(inti=0;i<3;i++){scanf("%d",&b[i]);}}intmain(){inta_count=0,a[3],b_count=0,b[3],result_count[2];fillVectors(a,b);compareTriplets(a_count,a,b_count,b,result_count);return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Compare the Triplets
You are viewing a single comment's thread. Return to all comments →