Second largest element in an array

Given an array (containing at most 1000 positive integers), find the second largest integer. If there exists no second largest integer, return-1, 

Input Specification:

 input1: length of the array input2: an array of positive integers 

Output Specification:

 Return the second largest number or-1 accordingly Example 1: input1: 3 input2: (2,1,2)..

..........................................................................................................................................................................


connect with me on
 
......................................................................................................................................................




connect with me on

Comments

Post a Comment

Popular posts from this blog

PERFECT SQUARE asked by MountainBlue

Harry and Porter asked in MountainBlue ,2022

Chomsky's hierarchy Explanation :