You are viewing a single comment's thread. Return to all comments →
How about Ruby Implementation?
def breaking_records(scores) min_el = max_el = scores[0] min_count = max_count = 0 (1...scores.length).each do |score| min, max = scores[0..score].min, scores[0..score].max if min < min_el min_el, min_count = min, (min_count += 1) elsif max > max_el max_el, max_count = max, (max_count += 1) end end [max_count, min_count] end
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 →
How about Ruby Implementation?