Given an array of unsorted integers, return the largest 3 integers in the array. Can you solve this in linear runtime?
Given an array of unsorted integers, return the largest 3 integers in the array. Can you solve this in linear runtime?
Permalink: http://problemotd.com/problem/top-3/
Content curated by @MaxBurstein
Comments:
mark - 10 years, 3 months ago
var unsortedIntArray = new[] { 2, 3, 77, 33, 12, 75, 2, 9, 34, 59, 21, 17 };
var top3 = unsortedIntArray.OrderByDescending(x => x).Take(3);
reply permalink
wobblebucket - 10 years, 3 months ago
reply permalink
asheehan - 10 years, 3 months ago
in Ruby
reply permalink
person - 10 years, 3 months ago
Erlang:
reply permalink
Foppe - 10 years, 3 months ago
reply permalink