Accepted solution

Breaking the Records(Hacker Rank)

Open original problem
Source code

// Complete the breakingRecords function below.

vector<int> breakingRecords(vector<int> scores)

{

   int max=scores[0];

   int min=scores[0];

   vector<int> scr;

   scr.push_back(0);

   scr.push_back(0);

   for(int i=1;i<scores.size();i++)

   {

       if(scores[i]>max)

       {

          max = scores[i];

          scr[0] ++;

       }

       if(scores[i]<min)

       {

           min = scores[i];

           scr[1]++;

       }

   }

   return scr;

}
Join the discussion

Add your comment