Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 1991. Find the index of nth maximum of a row vector of real numbers

Created by Pavan Toraty

Given a vector of real numbers x, find the index idx of n th maximum value. If nth maximum occurs more than once, return the indices of all those occurences.

Example 1:

Input: x = [2 4.5 3 1 3.33], n = 4

Output: idx = 1, since 4th maximum is 2

Example 2: Input: x = [2 4.5 3.33 3 1 3.33], n = 2

Output: idx = [3 6], since 2nd maximum is 3.33

Tags

Problem Group

Solution Statistics

15 correct solutions 12 incorrect solutions
Last solution submitted on Aug 22, 2014

Problem Comments

Solution Comments