How to find 3rd largest no from an arrray? In java. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 4

How to find 3rd largest no from an arrray? In java.

int[ ] arr = { 1,2,3,4,5}; output =3rd largest no is - 3

12th Jan 2020, 6:12 AM
manojkdm18
manojkdm18 - avatar
1 Réponse
+ 2
Just like Mirielle🐶 said, probably the simplest way is to import java.util.Arrays and use the Arrays.sort method and target index[2]
12th Jan 2020, 12:07 PM
HNNX 🐿
HNNX 🐿 - avatar