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.
You should never hard code numbers(0 is ok but any other number has no meaning). What is position 0 in the array? What is position 1 in the array? Create an enumeration to help give the positions within the array meaning.
publicenumNames:byte{Alice,// Alice = 0Bob// Bob = 1}staticint[]solve(inta0,inta1,inta2,intb0,intb1,intb2){// Complete this functionint[]alice={a0,a1,a2};int[]bob={b0,b1,b2};int[]result={0,0};for(inti=0;i<3;i++){if(alice[i]>bob[i]){result[(int)Names.Alice]++;}elseif(alice[i]<bob[i])result[(int)Names.Bob]++;}returnresult;
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 →
You should never hard code numbers(0 is ok but any other number has no meaning). What is position 0 in the array? What is position 1 in the array? Create an enumeration to help give the positions within the array meaning.