Medior
4 oktober 2026Vind de bug: Android
Eén stukje code. Vind de bug, of bewijs dat er geen is.
kotlin
1fun sortAndGetTop3(scores: MutableList<Int>): List<Int> {
2 scores.sort()
3 scores.reverse()
4 return scores.take(3)
5}
6
7fun displayResults(scores: MutableList<Int>) {
8 println("Original: $scores")
9 val top3 = sortAndGetTop3(scores)
10 println("Top 3: $top3")
11 println("All scores: $scores")
12}Klik op de regels die het probleem veroorzaken.
Jouw oordeel
Eén poging per dag. Het antwoord verschijnt direct daarna.
Behoud je reeks
Maak een account om je reeks te behouden en je voortgang te volgen.