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

LCM code tech mahindra 2022

Sum of largest and smallest element in array by tech mahindra 2022

Given an array A, find the size of the smallest subarray asked in MountainBlue, 2022