-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBreakingTheRecords.cpp
43 lines (38 loc) · 1.02 KB
/
BreakingTheRecords.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Maria plays college basketball and wants to go pro. Each season she maintains a record of Her Play
// She tabulates the number of times she breaks her season record for most points and Least points in a game.
// Points scored in the first game establish her record for the season, and she begins counting from there.
#include <bits/stdc++.h>
using namespace std;
vector<int> breakingRecords(vector<int> scores) {
int maxcount=0;
int mincount =0;
vector<int> count;
int max =scores[0],min=scores[0];
for(auto i:scores){
cout<<i<<endl;
if(i>max){
max = i;
maxcount++;
}
else if(i<min){
min=i;
mincount++;
}
}
count.push_back(maxcount);
count.push_back(mincount);
return count;
}
int main(){
int n;
cin>>n;
vector<int> scores(n);
for(int i=0;i<n;i++){
cin>>scores[i];
}
vector<int> result = breakingRecords(scores);
for(auto i:result){
cout<<i<<" ";
}
return 0;
}