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.
Would someone provide a help optimizing the below code?
didn't pass test case 6 and test case 8
int*climbingLeaderboard(intranked_count,int*ranked,intplayer_count,int*player,int*result_count){intj=0;intrankNoDups[ranked_count];for(inti=0;i<ranked_count;++i)//loop to remove duplication in ranked array{if(ranked[i]==ranked[i+1])//look for similar values.{continue;//skip below lines in case of similar values }rankNoDups[j]=ranked[i];//add unique values to rankNoDups arrayj++;//advance j by one}intcount=1;//set count to 1*result_count=player_count;//assign value of player_count to *result_count staticinta[100000];//array to stor for(intk=0;k<player_count;++k)//5,25,50,120 playerrank{for(inti=0;i<j;++i)//100,50,40,20,10 nodups{if(rankNoDups[i]<=player[k]){break;}count++;}*(a+k)=count;// printf("%d\n",*(a+k));count=1;}//result_count[k]=count;//printf(">>>>>>>%d<<<<<<<<",(sizeof(result_count)/sizeof(result_count[0])));returna;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Climbing the Leaderboard
You are viewing a single comment's thread. Return to all comments →
Would someone provide a help optimizing the below code? didn't pass test case 6 and test case 8