algorithms/implementation/breaking-best-and-worst-records.c
int* breakingRecords(int scores_count, int* scores, int* result_count) {

    int max_score = scores[0];
    int min_score = scores[0];
    int *records = malloc(2 * sizeof(int));
    records[0] = 0;
    records[1] = 0;
    
    for (int i = 0; i < scores_count; i++)
    {
        if (scores[i] > max_score)
        {
            max_score = scores[i];
            records[0]++;
        }
        if (scores[i] < min_score)
        {
            min_score = scores[i];
            records[1]++;
        }        
    }
    *result_count = 2;
    return records;
}
// Please store the size of the integer array to be returned in result_count pointer. For example,
// int a[3] = {1, 2, 3};
//
// *result_count = 3;
//
// return a;
//
Please store the size of the integer array to be returned in result_count pointer.



return a.
Please store the size of the integer array to be returned in result_count pointer . return a .
int* breakingRecords(int scores_count, int* scores, int* result_count) {
    int max_score = scores[0];
    int min_score = scores[0];
    int *records = malloc(2 * sizeof(int));
    records[0] = 0;
    records[1] = 0;
    for (int i = 0; i < scores_count; i++)
    {
        if (scores[i] > max_score)
        {
            max_score = scores[i];
            records[0]++;
        }
        if (scores[i] < min_score)
        {
            min_score = scores[i];
            records[1]++;
        }        
    }
    *result_count = 2;
    return records;
}
int * breakingRecords ( int scores_count , int * scores , int * result_count ) { int max_score = scores [ 0 ] ; int min_score = scores [ 0 ] ; int * records = malloc ( 2 * sizeof ( int ) ) ; records [ 0 ] = 0 ; records [ 1 ] = 0 ; for ( int i = 0 ; i < scores_count ; i ++ ) { if ( scores [ i ] > max_score ) { max_score = scores [ i ] ; records [ 0 ] ++ ; } if ( scores [ i ] < min_score ) { min_score = scores [ i ] ; records [ 1 ] ++ ; } } * result_count = 2 ; return records ; }
Please store the size of the integer array to be returned in result_count pointer.
Please store the size of the integer array to be returned in result_count pointer .