You are viewing a single comment's thread. Return to all comments →
C solution
int* breakingRecords(int scores_count, int* scores, int* result_count) { int hscores = scores[0],lscores = scores[0]; int hcount = 0,lcount = 0; for(int i = 0 ;i<scores_count;i++){ if(scores[i] > hscores){ hscores = scores[i]; hcount++; } else if(scores[i] < lscores){ lscores = scores[i]; lcount++; } } scores[0] = hcount; scores[1] = lcount; result_count[0] = 2; return scores; }
Seems like cookies are disabled on this browser, please enable them to open this website
Breaking the Records
You are viewing a single comment's thread. Return to all comments →
C solution