You are viewing a single comment's thread. Return to all comments →
Python solution is here:
import math import os import random import re import sys def breakingRecords(scores,n): new_list=[] count_max=0 count_min=0 new_list.append(scores[0]) for i in range(n-1): new_list.append(scores[i+1]) if max(new_list)==scores[i+1] and new_list.count(scores[i+1])==1: count_max+=1 elif min(new_list)==scores[i+1] and new_list.count(scores[i+1])==1: count_min+=1 return count_max,count_min if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') n = int(input().strip()) scores = list(map(int, input().rstrip().split())) result = breakingRecords(scores,n) fptr.write(' '.join(map(str, result))) fptr.write('\n') fptr.close()
Seems like cookies are disabled on this browser, please enable them to open this website
Breaking the Records
You are viewing a single comment's thread. Return to all comments →
Python solution is here: