Find second greater number in array. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Find second greater number in array.

13th Oct 2020, 5:42 AM
Muhammad Adnan
Muhammad Adnan - avatar
2 Answers
+ 2
Q/A section is not for giving challenges to others. TRY doing it yourself, if your stuck we will help u through. Dont forget to post an attempt of yours. Hope you understand😊😊 https://www.sololearn.com/discuss/1316935/?ref=app
13th Oct 2020, 5:44 AM
Steve Sajeev
Steve Sajeev - avatar
+ 1
Hint: 1. Sort the array im descending order (greatest to smallest). 2. Get the first element (index 0), this would be the largest number. 3. Setup a loop to iterate the array from the second element (index 1). You found the second greatest number when you find a number that is not the one you got at step 2. Break out the loop when the number has been found. Implementation is yours. Come to discuss when you have a tryout code at hand and are facing difficulties. Good luck! 👍
13th Oct 2020, 6:59 AM
Ipang