Second Largest Element | Array | Coding Ninjas | Code Verse 07 | Sachin Sharma

Опубликовано: 21 Сентябрь 2026
на канале: Code Verse 07
205
6

Top 100 Array Coding Problems Solutions | Coding Ninjas Platform
#array #placement #coding #codingninja #leetcode #twosum

Second Largest Element Problem Link :
https://www.codingninjas.com/studio/p...

Second Largest Element Code Link :
https://docs.google.com/document/d/1a...

Problem Statement :

You have been given an array/list 'ARR' of integers. Your task is to find the second largest element present in the 'ARR'.

Note:
a) Duplicate elements may be present.

b) If no such element is present return -1.

Example:

Input: Given a sequence of five numbers 2, 4, 5, 6, 8.
Output: 6

Explanation:
In the given sequence of numbers, number 8 is the largest element, followed by number 6 which is the second-largest element. Hence we return number 6 which is the second-largest element in the sequence.