We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#!/bin/python3importmathimportosimportrandomimportreimportsys## Complete the 'breakingRecords' function below.## The function is expected to return an INTEGER_ARRAY.# The function accepts INTEGER_ARRAY scores as parameter.#defbreakingRecords(scores):# Write your code hereint_array=[0,0]max_score=Nonemin_score=Noneforscoreinscores:ifmax_scoreisNone:max_score=scoreifmin_scoreisNone:min_score=scoreifmax_score<score:max_score=scoreint_array[0]+=1ifmin_score>score:min_score=scoreint_array[1]+=1returnint_arrayif__name__=='__main__':fptr=open(os.environ['OUTPUT_PATH'],'w')n=int(input().strip())scores=list(map(int,input().rstrip().split()))result=breakingRecords(scores)fptr.write(' '.join(map(str,result)))fptr.write('\n')fptr.close()
Cookie support is required to access HackerRank
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 →