Largest elements in an array

Question

Given an array with k distinct elements, write a function to return all elements that have at least two elements greater than themselves in the same array:

For example:

#Given the following:
array = [2,3,9,7,6]

#Your function should return:
[2,3,6]

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now