on-internet
← Community

Find the second largest number in an array

Stack Overflow ·

I have an array of three element like [31,23,12], and I want to find the second largest element and its related position without rearranging the array. Example: array = [21,23,34] Second_largest = 23; Position is = 1;

Comments

Sign in or sign up to comment and upvote.

No comments yet.