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/rubydefgetRecord(s)array=Array.newloop_length=s.count-1#checking for highest recordcounter=0maxScore=s[0]foriin(1..loop_length)ifs[i]>maxScorecounter=counter+1maxScore=s[i]endendarray<<counter#checking for least recordminScore=s[0]counter=0foriin(1..loop_length)ifs[i]<minScorecounter=counter+1minScore=s[i]endendarray<<counterreturnarrayendn=gets.strip.to_is=gets.strips=s.split(' ').map(&:to_i)result=getRecord(s)printresult.join(" ")
This solution in Ruby is working fine for all test cases.
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 →
This solution in Ruby is working fine for all test cases.