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

Given two sorted arrays of size m and n .Find the number of common elements in them and also find what are that common elements.