- 3
Find second greater number in array.
2 Antworten
+ 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
+ 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! 👍