+ 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
2 Respostas
+ 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