Mid-Level
October 4, 2026Spot the bug: Android
One snippet. Find the bug, or prove there isn't one.
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}Click the lines that carry the problem.
Your verdict
One attempt per day. The answer shows up right after.
Keep your streak
Create an account to keep your streak and track your progress.