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.
funbreakingRecords(scores:Array<Int>):Array<Int>{// Write your code herevalreturnArr=IntArray(2)valmax=Math.pow(10.toDouble(),8.toDouble()).toInt()if(scores.sizein1..1000&&scores.count{itin0..max}==scores.size){valfirstElement=scores[0]valdistinctArray=scores.distinct().filter{it!=firstElement}varmaxim=firstElementvarminim=firstElementvarmaxCount=0varminCount=0distinctArray.forEach{if(it>maxim){maxCount+=1maxim=it}elseif(it<minim){minCount+=1minim=it}}returnArr[0]=maxCountreturnArr[1]=minCount}returnreturnArr.toTypedArray()}
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 →