Five winners

  • 5
  • Locked
Onboard the CodeGym spaceship, students in Levels 7-8 completed a multi-stage contest to see who could complete tasks the fastest. Among the 20 semi-finalists, the five with highest scores are winners. So, we have an array with the semi-finalists' scores (note that scores can be negative). We'll display the magnificent top five.
You can't complete this task, because you're not signed in.
Comments (11)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 16 , Jacksonville, United States
23 January 2022, 03:25
Ok this was super frustrating but i finally figured out what was wrong. the prompt straight up lies to you. it wants you to be able to read 20 numbers from the keyboard/input *BUT* your code must accommodate for different array lengths. so just make your array code in the sort loop generic not based on an array of 20.
Adam Odoj
Level 22 , Poland
30 November 2021, 13:02
This one is tricky, but you cannot complain as it almost the same as task from the previous lesson about Arrays. There was task about printing array of input data in ascending order. Cool!!!
Level 11 , Dugo Selo, Croatia
1 September 2021, 20:43
going through array and set array from largest to smallest integer :)
Level 15 , Old Town, United States
4 May 2021, 14:58
Well, looked up Bubble Sort, and under the hood, it's basically the for-loop reversing the array, so what I did without actually writing it out. I guess I will use it from now on, but at least I know how it's doing it. Happy coding. :)
Level 15 , Old Town, United States
4 May 2021, 02:20
Didn't use the Bubble Sort and passed. What I don't understand is, why instruct us to create an array of 20 numbers and test with array with less than 20 numbers? Just had to change the condition of for-loop to i < array.length / 2 instead of i < 10 Since people have mentioned it, I will check out the Bubble Sort.
Lex Icon
Level 17 , Sofia, Bulgaria
20 December 2020, 02:34
HINT: Bubble Sort.
Level 41
6 November 2020, 08:27
Multiply the elements of array with -1, sort using the function for arrays, multiply again with -1. Good luck :)
Karas Java Developer
29 October 2020, 00:42
Ok, this one is really complicated, if you manually sort not using a for loop still the sorting will be wrong, I litterally manually sorted the array 20 lines of code... wrong. This exercise can be solved with bubble sorting is the most basic sorting.
Pavel Naumovich
Level 16 , Chippenham, United Kingdom
30 September 2020, 19:57
Sort method should be able to sort array of any length ( array.lenght )
Level 14 , Apeldoorn, Netherlands
19 July 2019, 15:02
All of my code is correct but it keeps saying that my sort method doesn't put the array in descending order when it does