File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
HackerRank-Breaking the Records Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/bin/python3
2
+
3
+ import math
4
+ import os
5
+ import random
6
+ import re
7
+ import sys
8
+
9
+ # Complete the breakingRecords function below.
10
+ def breakingRecords (scores ):
11
+ maxi = scores [0 ]
12
+ mini = scores [0 ]
13
+ maxcount = 0
14
+ mincount = 0
15
+ for i in range (len (scores )):
16
+ if (scores [i ]> maxi ):
17
+ maxi = scores [i ]
18
+ maxcount += 1
19
+ if (scores [i ]< mini ):
20
+ mini = scores [i ]
21
+ mincount += 1
22
+ return [maxcount , mincount ]
23
+
24
+ if __name__ == '__main__' :
25
+ fptr = open (os .environ ['OUTPUT_PATH' ], 'w' )
26
+
27
+ n = int (input ())
28
+
29
+ scores = list (map (int , input ().rstrip ().split ()))
30
+
31
+ result = breakingRecords (scores )
32
+
33
+ fptr .write (' ' .join (map (str , result )))
34
+ fptr .write ('\n ' )
35
+
36
+ fptr .close ()
You can’t perform that action at this time.
0 commit comments