- 2

How to find second largest number in an array

26th Apr 2022, 12:01 PM
Sajid Junejo
Sajid Junejo - avatar
1 Answer
+ 2
A) sort the array (and check from the end until 2nd largest found) Or B) find the largest number first, then the second largest (you could do it in a single iteration. If each number is unique in the array, you can simply the process.
26th Apr 2022, 12:35 PM
Lisa
Lisa - avatar