forked from amankayat/HackerRank-Solution-Algorithm-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbreakrecord.cpp
More file actions
32 lines (30 loc) · 669 Bytes
/
breakrecord.cpp
File metadata and controls
32 lines (30 loc) · 669 Bytes
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
#include<iostream>
#include<stdio.h>
using namespace std;
int *break_record(int scores[1000],int games){
int max=scores[0];
int min = scores[0];
int max_c =0,min_c=0;
static int c[10];
for(int i=0;i<games;i++){
if(scores[i]>max){
max=scores[i];
max_c++;
}else if(scores[i]<min){
min = scores[i];
min_c++;
}
}
c[0]=max_c;
c[1]=min_c;
return c;
}
int main(){
int games,scores[1000];
cin>>games;
for(int i=0;i<games;i++)
cin>>scores[i];
int *results = break_record(scores,games);
for(int i=0;i<2;i++)
cout<<results[i]<<" ";
}